param( [string]$msi, [string]$mst ) $errorActionPreference="Stop" $drivePath="%SYSTEMDRIVE%" $regkey = 'HKLM:SOFTWARE\AdventNet\DesktopCentral\DCAgent' if(Test-Path $regkey){ $agentVersion =(Get-ItemProperty $regkey).DCAgentVersion } else{ $regkey = 'HKLM:SOFTWARE\Wow6432Node\AdventNet\DesktopCentral\DCAgent' if(Test-Path $regkey){ $agentVersion =(Get-ItemProperty $regkey).DCAgentVersion } } if( -not $agentVersion) { #Write-Output $PSScriptRoot [string]$msiFile = "$PSScriptRoot\$msi" [string]$mstFile = "$PSScriptRoot\$mst" cmd /c "msiexec.exe /i $msiFile TRANSFORMS=$mstFile ENABLESILENT=yes REBOOT=ReallySuppress /qn MSIRESTARTMANAGERCONTROL=Disable INSTALLSOURCE=GPO /lv $DrivePath\dcagentInstaller.log" } #Set-ExecutionPolicy RemoteSigned - cmd to allow PS scripts