REMOTE INSTALL :: Install Automox Remotely when using ConnectWise (ScreenConnect) & PowerShell

While attempting to implement Automox on distant systems (without an application deployment agent already on the individual systems), I was presented with a problem:

How do I get Automox installed remotely? Quickly? Quietly? And, most importantly, without having to interact with another carbon-based being??

In my case, I have ConnectWise deployed and running on distant assets. Using ConnectWise to remotely support distant systems, I have found the occasional need to incidentally run command-line using either windows CMD or PowerShell commands. Pushing Automox seemed like one of those times I should lean on this command-line resource. I have high hopes Automox Worklets will minimize dependencies on this ConnectWise command-line interface!!? :money_mouth_face::money_mouth_face::money_mouth_face:

When using multi-line Powershell commands/scripts that take more than a few seconds to finish, consider using the below within the ConnectWise command-line interface:

#!ps
#maxlength=50000
#timeout=300000

To have the remote Windows system download, install and cleanup the installer file, paste below into ConnectWise command-line interface:

#!ps
#maxlength=50000
#timeout=300000

#Requires -Version 3.0

$installer = "https://console.automox.com/Automox_Installer-latest.msi"
$downloadobject = "c:\Automox_Installer-latest.msi"
$AutomoxKey = "<Insert Access Key Here>"

powershell -command "Invoke-WebRequest -Uri ${installer} -OutFile ${downloadobject}"
    
(Start-Process "msiexec.exe" `
-ArgumentList "/i $downloadobject /qn /norestart ACCESSKEY=$AutomoxKey" `
-NoNewWindow -Wait -PassThru).ExitCode
     
del $downloadobject

Note: The Invoke-WebRequest cmdlet was introduced in PowerShell 3.0

On Apple OS devices, to have the remote system download and install the installer file, paste below into ConnectWise command-line interface:

curl -sS https://console.automox.com/downloadInstaller?accesskey=<Insert Access Key Here>| sudo bash
launchctl load /Library/LaunchDaemons/com.automox.agent.plist

Note: As I do not know exactly how the curl switch -sS works, I am not sure how Apple handles the cleanup of this downloaded installer.

References:

Please test any gold nugget you find using your mad google-fu skills BEFORE you fling it at your production systems. :crazy_face::mask::skull_and_crossbones:

1 Like

This is awesome, thanks for sharing this @jermicide!