fix Install-Wireguard.ps1 to properly launch after install

add Install-AteraAgent.ps1
This commit is contained in:
2021-01-21 12:32:59 -05:00
parent 6266d6c676
commit b063f1a833
3 changed files with 35 additions and 3 deletions
+31
View File
@@ -0,0 +1,31 @@
param(
[Parameter(Mandatory=$true)][int]$CUSTOMER_ID,
[Parameter(Mandatory=$true)][int]$INTEGRATOR_ID,
[Parameter(Mandatory=$false)][string]$AGENT_FILENAME="EmberkomAgentSetup.exe"
)
## Source the Tools.ps1 script
Function SourceTools
{ . $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1'))) }
. SourceTools
## Build the path for $AGENT_INSTALLER
$AGENT_INSTALLER = '{0}{1}' -f (GetTempPath), $AGENT_FILENAME
## Make sure we need to install the agent
If ( !(Test-Path "${Env:ProgramFiles}\ATERA Networks\AteraAgent\AteraAgent.exe") )
{
## Download agent and get path
$AGENT_INSTALLER = Download-File -URL "http://emberkom.servicedesk.atera.com/GetAgent/Msi/?customerId=${CUSTOMER_ID}&integratorLogin=${INTEGRATOR_ID}" -File $AGENT_INSTALLER
## Install the agent
Try { Start-Process "msiexec.exe" -ArgumentList "/i ""${AGENT_INSTALLER}"" /qn /norestart" -Wait }
Catch { LogErr $_.Exception.Message }
## Remove agent installer
Try { Remove-Item $AGENT_INSTALLER -Force }
Catch { LogErr $_.Exception.Message }
} Else { LogMsg "The agent is already installed on this endpoint." }
+1 -1
View File
@@ -12,7 +12,7 @@ If ( IsAdmin )
Catch { LogErr $_.Exception.Message ; Exit } Catch { LogErr $_.Exception.Message ; Exit }
## Install manager service ## Install manager service
Try { Start-Process "wireguard.exe" -ArgumentList '/installmanagerservice' -Wait -ErrorAction SilentlyContinue } Try { Start-Process "${Env:ProgramFiles}\WireGuard\wireguard.exe" -ArgumentList '/installmanagerservice' -Wait -ErrorAction SilentlyContinue }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
## Create shortcut on Public desktop ## Create shortcut on Public desktop
+3 -2
View File
@@ -3,5 +3,6 @@
Dot source any of the Powershell scripts with the following: Dot source any of the Powershell scripts with the following:
. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('$URL'))) . $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('$URL')))
Dot source the Tools.ps1 script with the following: Dot source the Tools.ps1 script and run a live PS script:
. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1'))) . $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1')))
Run-Script -LivePSScript Script-Name