24 lines
772 B
PowerShell
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
|
|
}
|
|
}
|