Add RMM scripts
This commit is contained in:
parent
eece8b58c8
commit
4a54e482cd
@ -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
|
||||
end {
|
||||
if (Test-Path $InstallerPath) {
|
||||
Write-Host "Removing package download from '$InstallerPath'"
|
||||
Remove-Item -Path $InstallerPath -Force
|
||||
}
|
||||
}
|
||||
27
rmm/ConnectWise RMM/Remove-CWRMM.ps1
Normal file
27
rmm/ConnectWise RMM/Remove-CWRMM.ps1
Normal file
@ -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 }
|
||||
56
rmm/NinjaOne/Install-NinjaRmm.ps1
Normal file
56
rmm/NinjaOne/Install-NinjaRmm.ps1
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user