From 4a54e482cd51f190d493809839b4bbf2eb7bad03 Mon Sep 17 00:00:00 2001 From: Corbin Date: Fri, 2 Jan 2026 14:21:40 -0500 Subject: [PATCH] Add RMM scripts --- rmm/ConnectWise RMM/Install-CWRMM.ps1 | 72 ++++++++++++++++++--------- rmm/ConnectWise RMM/Remove-CWRMM.ps1 | 27 ++++++++++ rmm/NinjaOne/Install-NinjaRmm.ps1 | 56 +++++++++++++++++++++ 3 files changed, 131 insertions(+), 24 deletions(-) create mode 100644 rmm/ConnectWise RMM/Remove-CWRMM.ps1 create mode 100644 rmm/NinjaOne/Install-NinjaRmm.ps1 diff --git a/rmm/ConnectWise RMM/Install-CWRMM.ps1 b/rmm/ConnectWise RMM/Install-CWRMM.ps1 index 1905cd2..d0f5e45 100644 --- a/rmm/ConnectWise RMM/Install-CWRMM.ps1 +++ b/rmm/ConnectWise RMM/Install-CWRMM.ps1 @@ -1,32 +1,56 @@ -#!ps -#timeout=3000000 +[CmdletBinding()] +param ( + [Parameter(Mandatory=$true)] + [String] + $Token +) -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12 +<# +.SYNOPSIS + Install ConnectWise RMM +.DESCRIPTION + Download and install the ConnectWise RMM agent with the given token +.PARAMETER Token + Agent install token (required) +.EXAMPLE + .\Install-CWRMM.ps1 -Token '7672b2ed-c04c-477c-9d34-341762cdaeee' +#> -$PackagesPath = 'C:\Packages' +begin { + $InstallerUrl = 'https://prod.setup.itsupport247.net/windows/BareboneAgent/32/ITSagent/MSI/setup' + $InstallerPath = Join-Path -Path $env:TEMP -ChildPath 'AsioAgentInstaller.msi' +} -$AgentInstallUrl = '' -$AgentInstallFile = "$(($AgentInstallUrl -split '/')[6]).msi" -$AgentInstallPath = Join-Path -Path $PackagesPath -ChildPath $AgentInstallFile +process { + Write-Host "Installing ConnectWise RMM with token '$token'..." -# Prep + # Download + try { + Write-Host "Downloading application..." -# Create the $PackagesPath directory if it doesn't already exist -if (-not (Test-Path -PathType Container $PackagesPath)) { New-Item -ItemType Directory -Path $PackagesPath | Out-Null } + $ProgressPreference = 'SilentlyContinue' + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12 + # Use Legacy WebClient for compatibility + (New-Object Net.WebClient).DownloadFile($InstallerUrl, $InstallerPath) + } catch { + throw "Failed downloading application. $_" + } -# Download - -Write-Host "Downloading agent installer..." -# Use Legacy WebClient for compatibility -(New-Object Net.WebClient).DownloadFile($AgentInstallUrl, $AgentInstallPath) - -# Install - -Write-Host "Starting installation..." -Start-Process msiexec -ArgumentList "/i `"$AgentInstallPath`" /q /lv `"$($AgentInstallPath).log`"" -Wait -Write-Host "Log saved at $($AgentInstallPath).log" + # Install + try { + Write-Host "Installing application..." + Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/i `"$InstallerPath`" TOKEN=$Token /qn /lv `"$($InstallerPath).log`"" -Wait + Write-Host "Log saved at '$($InstallerPath).log'" + # Get-Content "$($InstallerPath).log" + } catch { + throw "Failed installing application. $_" + } +} # Clean up - -Write-Host "Removing package download from '$ArchivePath'" -Remove-Item -Path $AgentInstallPath -Force \ No newline at end of file +end { + if (Test-Path $InstallerPath) { + Write-Host "Removing package download from '$InstallerPath'" + Remove-Item -Path $InstallerPath -Force + } +} \ No newline at end of file diff --git a/rmm/ConnectWise RMM/Remove-CWRMM.ps1 b/rmm/ConnectWise RMM/Remove-CWRMM.ps1 new file mode 100644 index 0000000..fa4f576 --- /dev/null +++ b/rmm/ConnectWise RMM/Remove-CWRMM.ps1 @@ -0,0 +1,27 @@ +#!ps +#timeout=3000000 +#maxlength=999999999 + +wmic product where "name like '%ITSPlatform%'" call uninstall /nointeractive +(Get-WmiObject -Class Win32_Product | where { $_.Name -like "*ITSPlatform*" }).Uninstall() + +@( + "SAAZappr" + "SAAZDPMACTL" + "SAAZRemoteSupport" + "SAAZScheduler" + "SAAZServerPlus" + "SAAZWatchDog" +) | % { spsv $_ } +if (Test-Path "C:\Program Files (x86)\SAAZOD") { ri "C:\Program Files (x86)\SAAZOD" -Force -Recurse } +if (Test-Path "C:\Program Files (x86)\SAAZODBKP") { ri "C:\Program Files (x86)\SAAZODBKP" -Force -Recurse } +rp -Path "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest" -Name "ITSPlatformID" -Force -ea SilentlyContinue +@( + "HKLM:\SOFTWARE\WOW6432Node\SAAZOD" + "HKLM:\SYSTEM\CurrentControlSet\Services\SAAZappr" + "HKLM:\SYSTEM\CurrentControlSet\Services\SAAZDPMACTL" + "HKLM:\SYSTEM\CurrentControlSet\Services\SAAZRemoteSupport" + "HKLM:\SYSTEM\CurrentControlSet\Services\SAAZScheduler" + "HKLM:\SYSTEM\CurrentControlSet\Services\SAAZServerPlus" + "HKLM:\SYSTEM\CurrentControlSet\Services\SAAZWatchDog" +) | % { ri $_ -Force -ea SilentlyContinue } diff --git a/rmm/NinjaOne/Install-NinjaRmm.ps1 b/rmm/NinjaOne/Install-NinjaRmm.ps1 new file mode 100644 index 0000000..626ba12 --- /dev/null +++ b/rmm/NinjaOne/Install-NinjaRmm.ps1 @@ -0,0 +1,56 @@ +[CmdletBinding()] +param ( + [Parameter(Mandatory=$true)] + [String] + $Token +) + +<# +.SYNOPSIS + Install Ninja RMM +.DESCRIPTION + Download and install the Ninja RMM agent with the given token +.PARAMETER Token + Agent install token (required) +.EXAMPLE + .\Install-NinjaRmm.ps1 -Token '90a92722-da34-452c-99e0-af8be7fcbf0c' +#> + +begin { + $InstallerUrl = 'https://us2.ninjarmm.com/ws/api/v2/generic-installer/NinjaOneAgent-x86.msi' + $InstallerPath = Join-Path -Path $env:TEMP -ChildPath 'NinjaOneAgent-x86.msi' +} + +process { + Write-Host "Installing Ninja RMM with token '$Token'..." + + # Download + try { + Write-Host "Downloading application..." + + $ProgressPreference = 'SilentlyContinue' + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12 + # Use Legacy WebClient for compatibility + (New-Object Net.WebClient).DownloadFile($InstallerUrl, $InstallerPath) + } catch { + throw "Failed downloading application. $_" + } + + # Install + try { + Write-Host "Installing application..." + Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/i `"$InstallerPath`" TOKENID=`"$Token`" /qn /L*V `"$($InstallerPath).log`"" -Wait + Write-Host "Log saved at '$($InstallerPath).log'" + # Get-Content "$($InstallerPath).log" + } catch { + throw "Failed installing application. $_" + } +} + +# Clean up +end { + if (Test-Path $InstallerPath) { + Write-Host "Removing package download from '$InstallerPath'" + Remove-Item -Path $InstallerPath -Force + } +} \ No newline at end of file