Jump to content

Recommended Posts

Posted (edited)

It was requested I post this so hopefully someone else in the community can benefit.  Until we are able to deploy Bitdefender from within Pulseway, this is the next best thing.  I wrote this again, for my clientele who generally are PS 3.0 + so some small adjustments may be needed if you are attempting to run this on PS 2.0.

This will download and silently install Bitdefender.  All you need to edit is the $BitdefenderURL and possibly the $BaseURL depending.  When you log into GravityZone and make a package and go to get install links, the base URL in your portal will always be the same followed by the remaining part of the URL which can change based on the package.  If you just make 1 generic one and then move the machines after install, you will only need to edit this once.  I've left my base URL in the script so you can see that part and the beginning of the unique part so you can easily know what to change. 

Function New-FileDownload {
    param(
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [string]$Url,
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [string]$Destination
    )
    $webClient = New-Object System.Net.WebClient
    $webClient.DownloadFile($Url$Destination)
    if (Test-Path -LiteralPath $Destination) {
        Write-Verbose "File downloaded Successfully"
        return $true
    }
    else {
        Write-Verbose "File download Failed"
        return $false
    }
}
 
$Installed = Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" | 
Where-Object { $_.DisplayName -eq "Bitdefender Endpoint Security Tools" }
 
if ($Installed) {
    Write-Output "Bitdefender already installed. Exiting."
    Exit 1
}
 
$BitdefenderURL = "setupdownloader_thisistheuniquepart.exe"
Write-Output "Beginning download of Bitdefender..."
$BaseURL = "https://cloud.gravityzone.bitdefender.com/Packages/BSTWIN/0/"
$URL = $BaseURL + $BitdefenderURL
$Destination = "$($env:TEMP)\$($BitdefenderURL)"
 
$FileDownload = New-FileDownload -Url $URL -Destination $Destination
if ($FileDownload) {
    Write-Output "Download succeeded, beginning install..."
    Start-Process $Destination -ArgumentList "/bdparams /silent silent" -Wait -NoNewWindow
    Start-Sleep -Seconds 30
}
else {
    Write-Output "File failed to download. Exiting."
    Exit 1
}
$Installed = Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" | 
Where-Object { $_.DisplayName -eq "Bitdefender Endpoint Security Tools" }
 
if ($Installed) {
    Write-Output "Bitdefender successfully installed."
    Exit 0
}
else {
    Write-Output "ERROR: Failed to install Bitdefender"
    Exit 1
}
Edited by Mark G38

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...