Files
management-scripts/Install-ManagementAgent.ps1
T
2020-05-22 14:35:46 -04:00

24 lines
772 B
PowerShell

[CmdletBinding()]
param(
[string]$AGENT_URL,
[string]$AGENT_FILENAME='EmberkomAgentSetup.exe'
)
$TEMP = [System.IO.Path]::GetTempPath()
$AGENT_INSTALLER = "${TEMP}\${AGENT_FILENAME}"
## Make sure the AGENT_URL is specified
If ( $AGENT_URL )
{
## Make sure we need to install the agent
If ( !(Test-Path 'HKLM:SOFTWARE\N-able Technologies\NcentralAsset') -and !(Test-Path 'SOFTWARE\Wow6432Node\N-able Technologies\NcentralAsset'))
{
## Download the agent
If ( Test-Path $AGENT_INSTALLER ) { Remove-Item $AGENT_INSTALLER -Force }
(New-Object System.Net.WebClient).DownloadFile("${AGENT_URL}", $AGENT_INSTALLER)
## Install the agent
Start-Process $AGENT_INSTALLER -ArgumentList '/quiet /passive' -Wait
}
}