Using Connectwise RMM (Asio) with AVD Hosts / Deploying RMM via script

Anyone deploying Connectwise RMM (Asio) agents via powershell script? How are you pushing to your endpoints? I know we can use the links they provide but it requires someone to download and manually install. Looking to be able to push from script so we can use it with Azure AVD environments.

0

Comments (5 comments)

Avatar
Dave Stephenson
(Edited )

I'm not familiar with ConnectWise Asio, but I'm guessing deployment could/would be similar to deploying ScreenConnect agents.

Deploy ConnectWise Control with Scripted Action – Nerdio Help Center

If you have some documentation from CW on deploying it, I could give it "the old college glance" to see if I can help out.
Another option would be to package the app in a Nerdio WinGet repository.

0
Avatar
Marcos Artiaga

So I've actually been working on a script that will deploy the ConnectWise RMM agent. You will need to set up some secure variables but it should then work. 

#This script requires you to define the following secure variables. To do this, go to Settings > Portal in the customer's account.
#CwRmmDownloadURL - Get this from Devices > Manage > Download Agent > Select the site > Copy the Windows OS Agent URL
#CwRmmClientSiteName - Get this from Devices > Manage > Download Agent > Select the site
#CwRmmAgentToken - Get this from Devices > Manage > Download Agent > Select the site > Copy the token

# Define the URL of the installer
$DownloadURL = $SecureVars.CwRmmDownloadURL

# Define variables for ClientSiteName and AgentToken
$ClientSiteName = $SecureVars.CwRmmClientSiteName
$AgentToken = $SecureVars.CwRmmAgentToken

# Construct the filename with special characters and enclose it in double quotes
$FileName = "$ClientSiteName" + "_Windows_OS_ITSPlatform_TKN$AgentToken.msi"

# Define the destination folder
$SaveDirectory = "C:\Installers\ITSM"
if (!(Test-Path $SaveDirectory)) {
    New-Item -Path $SaveDirectory -ItemType Directory -Force | Out-Null
}

$FilePath = Join-Path -Path $SaveDirectory -ChildPath $FileName

# Download the file using Invoke-WebRequest
try {
    Invoke-WebRequest -Uri $DownloadURL -OutFile $FilePath -ErrorAction Stop
    Write-Output "Downloaded: $FilePath"

    # Run the downloaded file with /q for silent install
    Start-Process -FilePath $FilePath -ArgumentList '/q' -Wait
    Write-Output "Installation completed silently."
} catch {
    Write-Error "Failed to download or install the file. $_"
}

You will need to create the following secure variables.

Test it out and let me know!

1
Avatar
Gregory Barr
(Edited )

This is the script I use currently to install ConnectWise RMM agent on VM re-image and create. It needs URL to download agent and full path to download to. It will attempt download multiple times should it fail and checks MSI for product name matching "ITSPlatform" to validate. So far, I've just been creating a copy for each site with the variables defined in the script.

 

# Desktop agent download URL from RMM Setup
$DPMAAgentURL = 
 
# Desktop agent MSI file name (full path)
$DPMAAgentFile = 
 
# Attempt to download DPMA MSI
$HTTPResponse = Invoke-WebRequest -Uri $DPMAAgentURL -OutFile $DPMAAgentFile
 
If($HTTPResponse -eq $Null){$HTTPResponseOutput = "Null"}Else{$HTTPResponseOutput = $HTTPResponse}
write-host "HTTPResponse is $HTTPResponseOutput"
 
# If download status code not equal $Null, attempt download up to 5 more times
$i = 1
$max = 2
DO {
   Write-Host "Entered loop iteration $i"
   If($HTTPResponse -eq $Null) {
      write-host "Matched Null, exiting loop"
      break}
   $HTTPResponse = Invoke-WebRequest -Uri $DPMAAgentURL -OutFile $DPMAAgentFile
   write-host "HTTPResponse is $HTTPResponse"
   #$i
   $i++
} WHILE ($i -le $max)
 
 
# Read properties from downloaded MSI file
$msifile = $DPMAAgentFile
 
$WindowsInstaller = New-Object -ComObject WindowsInstaller.Installer
$MSIDatabase = $WindowsInstaller.GetType().InvokeMember('OpenDatabase', 'InvokeMethod', $Null, $WindowsInstaller, @($msifile, 0))
$Query = 'SELECT * FROM Property'
$View = $MSIDatabase.GetType().InvokeMember('OpenView', 'InvokeMethod', $null, $MSIDatabase, ($Query))
$View.GetType().InvokeMember('Execute', 'InvokeMethod', $null, $View, $null)
 
$hash = @{}
$MSIResult = while ($Record = $View.GetType().InvokeMember('Fetch', 'InvokeMethod', $null, $View, $null)) {
$name = $Record.GetType().InvokeMember('StringData', 'GetProperty', $null, $Record, 1)
$value = $hashMSIValue = $Record.GetType().InvokeMember('StringData', 'GetProperty', $null, $Record, 2)
$hash.Add($name,$value)
}
$msiProperties = [pscustomobject]$hash
 
 
$ProductName = $msiProperties | Select-Object -Expand ProductName
# Write-Host $ProductName
 
# Verify MSI by checking ProductName value. Install if match
If ($ProductName -eq "ITSPlatform"){
   #Write-Host "ProductName matches"
   start-process msiexec.exe -Wait -ArgumentList "/I $DPMAAgentFile /quiet"
} else {Write-Host "MSI check failed"}
0
Avatar
Bill

This may be a stupid question, but can you then use ScreenConnect to share the screen of individual user sessions?

0
Avatar
Gregory Barr
(Edited )

Yes, Bill, you can select the session you want to connect to in ScreenConnect when the agent is installed.

The biggest gripe I've got right now with the Asio agent is that they switched from separate Server and Desktop agent installers to a single Windows agent installer. There are no switches to control what type and Windows 10 Enterprise multi-session is being setup as a server. It's now more work to do after a re-image of AVD host to go and change the agent type over to Desktop and then go and suspend device down alerts that got configured because it was initially setup as a server. I expect these devices to go down due to auto-scale, I really don't like that I get alerts about it.

0

Please sign in to leave a comment.