update
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$TOKEN,
|
||||
[int]$CUSTOMER_ID,
|
||||
[int]$SOFTWARE_ID=101,
|
||||
[sring]$SERVER='manage.emberkom.com',
|
||||
[string]$AGENT_FILENAME='EmberkomAgentSetup.exe'
|
||||
)
|
||||
|
||||
@@ -32,14 +34,14 @@ $AGENT_INSTALLER = "${TEMP}${AGENT_FILENAME}"
|
||||
Write-Log "Agent installer will be saved to: ${AGENT_INSTALLER}"
|
||||
|
||||
## Make sure the CUSTOMER_ID is specified
|
||||
If ( $CUSTOMER_ID )
|
||||
If ( $CUSTOMER_ID -and $TOKEN )
|
||||
{
|
||||
## 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'))
|
||||
{
|
||||
## Build the AGENT_URL
|
||||
$AGENT_URL = 'https://manage.emberkom.com/downloadAgentOrProbeSoftwareDownloadAction.action?customerId={0}&softwareId={1}' -f $CUSTOMER_ID.ToString(),$SOFTWARE_ID.ToString()
|
||||
write-host $AGENT_URL
|
||||
#$AGENT_URL = 'https://manage.emberkom.com/downloadAgentOrProbeSoftwareDownloadAction.action?customerId={0}&softwareId={1}' -f $CUSTOMER_ID.ToString(),$SOFTWARE_ID.ToString()
|
||||
$AGENT_URL = 'https://manage.emberkom.com/download/2020.1.0.202/winnt/N-central/WindowsAgentSetup.exe'
|
||||
|
||||
## Delete $AGENT_INSTALLER if it already exists
|
||||
If ( Test-Path $AGENT_INSTALLER )
|
||||
@@ -56,7 +58,7 @@ If ( $CUSTOMER_ID )
|
||||
|
||||
## Install the agent
|
||||
Write-Log "Begin installing agent"
|
||||
Try { Start-Process $AGENT_INSTALLER -ArgumentList '/quiet /passive' -Wait }
|
||||
Try { Start-Process $AGENT_INSTALLER -ArgumentList "/s /v /qn CUSTOMERID=${CUSTOMER_ID} CUSTOMERSPECIFIC=1 REGISTRATION_TOKEN=${TOKEN} SERVERPROTOCOL=HTTPS SERVERADDRESS=${SERVER} SERVERPORT=443" -Wait }
|
||||
Catch { Write-Log $_.Exception.Message }
|
||||
|
||||
## Remove the agent installer
|
||||
@@ -69,4 +71,4 @@ If ( $CUSTOMER_ID )
|
||||
|
||||
Write-Log "Agent installation script has finished"
|
||||
} Else { Write-Log "The agent is already installed on this endpoint." }
|
||||
} Else { Write-Log "No CUSTOMER_ID was specified!" }
|
||||
} Else { Write-Log "No CUSTOMER_ID or TOKEN was specified!" }
|
||||
|
||||
Reference in New Issue
Block a user