#PowerShell Script to Install Desktop Central Agent #========================================== #To install agent in AruzeAD Environment #=================================================================== $errorActionPreference="Stop" $drivePath= [Environment]::ExpandEnvironmentVariables('%SYSTEMROOT%') $drivePath += "\temp" if(!(Test-Path $drivePath)){ New-Item -ItemType Directory -Path $drivePath } Write-Output $drivePath $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) { [string]$msifile = [string]$mstFile = [string]$jsonFile = $Destination = "$drivePath\DesktopCentralAgent.msi" Write-Output $Destination $link1 = Invoke-WebRequest -uri $msifile -OutFile $Destination $Destination2 = "$drivePath\DesktopCentralAgent.mst" Write-Output $Destination2 $link2 = Invoke-WebRequest -uri $mstFile -OutFile $Destination2 $Destination3 = "$drivePath\DCAgentServerInfo.json" Write-Output $Destination3 $link3 = Invoke-WebRequest -uri $jsonFile -OutFile $Destination3 cmd /c "msiexec.exe /i $Destination TRANSFORMS=$Destination2 ENABLESILENT=yes REBOOT=ReallySuppress /qn MSIRESTARTMANAGERCONTROL=Disable INSTALLSOURCE=GPO /lv $drivePath\dcagentInstaller.log" } exit 1