Inital commit.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$PackageID,
|
||||
[Parameter(Mandatory=$false)]
|
||||
[switch]$AllowReboot=$false
|
||||
)
|
||||
|
||||
## Set the reboot value
|
||||
If ( $AllowReboot ) { $Reboot = '1' } Else { $Reboot = '0' }
|
||||
|
||||
## URL to the BitDefender signed MSI archive
|
||||
$BDSignedArchiveURL = 'http://download.bitdefender.com/business/misc/kb1695/eps_installer_signed.zip'
|
||||
|
||||
## Set and create the local path to download the archive into
|
||||
$DownloadDirectory = "${Env:TEMP}\bd-installer"
|
||||
|
||||
## Delete any existing data and create a new empty $DownloadDirectory
|
||||
If ( Test-Path $DownloadDirectory) { Remove-Item $DownloadDirectory -Recurse -Force }
|
||||
New-Item -ItemType Directory -Path $DownloadDirectory -Force
|
||||
|
||||
## Set the full path to the zip file we'll download
|
||||
$BDZipArchive = "{0}\{1}" -f $DownloadDirectory,$(Split-Path -Path $BDSignedArchiveURL -Leaf)
|
||||
|
||||
## Download the archive
|
||||
(New-Object System.Net.WebClient).DownloadFile($BDSignedArchiveURL,$BDZipArchive)
|
||||
|
||||
## Unzip the archive
|
||||
Add-Type -Assembly “System.IO.Compression.FileSystem”
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory($BDZipArchive,$DownloadDirectory)
|
||||
|
||||
## Get the MSI file
|
||||
$MSI = (Get-ChildItem -Path $DownloadDirectory | Where { $_.Extension -ieq ".msi" }).FullName
|
||||
|
||||
## Launch the installer
|
||||
Start-Process "msiexec.exe" -ArgumentList "/i ${MSI} /qn GZ_PACKAGE_ID=${PackageID} REBOOT_IF_NEEDED=${Reboot}" -Wait
|
||||
Reference in New Issue
Block a user