Add installation scripts
This commit is contained in:
parent
1b91c295e9
commit
06a799cc10
32
rmm/ConnectWise RMM/Install-CWRMM.ps1
Normal file
32
rmm/ConnectWise RMM/Install-CWRMM.ps1
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!ps
|
||||||
|
#timeout=3000000
|
||||||
|
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
$PackagesPath = 'C:\Packages'
|
||||||
|
|
||||||
|
$AgentInstallUrl = ''
|
||||||
|
$AgentInstallFile = "$(($AgentInstallUrl -split '/')[6]).msi"
|
||||||
|
$AgentInstallPath = Join-Path -Path $PackagesPath -ChildPath $AgentInstallFile
|
||||||
|
|
||||||
|
# Prep
|
||||||
|
|
||||||
|
# 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 }
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
|
||||||
|
Write-Host "Removing package download from '$ArchivePath'"
|
||||||
|
Remove-Item -Path $AgentInstallPath -Force
|
33
windows/Install-ConnectSecureAgent.ps1
Normal file
33
windows/Install-ConnectSecureAgent.ps1
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
$PackagesPath = 'C:\Packages'
|
||||||
|
|
||||||
|
$TenantId = ''
|
||||||
|
$CompanyId = ''
|
||||||
|
$UserSecret = ''
|
||||||
|
|
||||||
|
$AgentInstallUrl = (Invoke-RestMethod -Method "Get" -URI "https://configuration.myconnectsecure.com/api/v4/configuration/agentlink?ostype=windows&msi_required=true")
|
||||||
|
$AgentInstallFile = 'cybercnsagent.msi'
|
||||||
|
$AgentInstallPath = Join-Path -Path $PackagesPath -ChildPath $AgentInstallFile
|
||||||
|
|
||||||
|
# Prep
|
||||||
|
|
||||||
|
# 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 }
|
||||||
|
|
||||||
|
# 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 WRAPPED_ARGUMENTS=`"-c $CompanyId -e $TenantId -j $UserSecret -i`" /lv `"$($AgentInstallPath).log`"" -Wait
|
||||||
|
Write-Host "Log saved at $($AgentInstallPath).log"
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
|
||||||
|
Write-Host "Removing package download from '$ArchivePath'"
|
||||||
|
Remove-Item -Path $AgentInstallPath -Force
|
40
windows/Install-IPerf3.ps1
Normal file
40
windows/Install-IPerf3.ps1
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
$PackagesPath = 'C:\Packages'
|
||||||
|
$DestinationPath = 'C:\Program Files\iperf3'
|
||||||
|
|
||||||
|
$InstallerUrl = 'https://github.com/ar51an/iperf3-win-builds/releases/download/3.17.1/iperf-3.17.1-win64.zip'
|
||||||
|
|
||||||
|
$ArchivePath = Join-Path -Path $PackagesPath -ChildPath ($InstallerUrl | Select-String -Pattern "(iperf-(?:\d\.?)+-win64\.zip)").Matches.Value
|
||||||
|
|
||||||
|
# Exit if the application is already installed
|
||||||
|
if (Test-Path $DestinationPath) { Write-Host 'iPerf3 is already installed.'; exit }
|
||||||
|
|
||||||
|
# Prep
|
||||||
|
|
||||||
|
# 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 }
|
||||||
|
|
||||||
|
# Download
|
||||||
|
|
||||||
|
Write-Host "Downloading application..."
|
||||||
|
# Use Legacy WebClient for compatibility
|
||||||
|
(New-Object Net.WebClient).DownloadFile($InstallerUrl, $ArchivePath)
|
||||||
|
|
||||||
|
# Extract
|
||||||
|
|
||||||
|
Write-Host "Extracting application..."
|
||||||
|
Expand-Archive -Path $ArchivePath -DestinationPath $DestinationPath -Force
|
||||||
|
Write-Host "Application extracted to $DestinationPath"
|
||||||
|
|
||||||
|
# Install
|
||||||
|
|
||||||
|
Write-Host "Installing application..."
|
||||||
|
|
||||||
|
# Add the DestinationPath to Path system environment variable
|
||||||
|
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$DestinationPath\", [System.EnvironmentVariableTarget]::Machine)
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
|
||||||
|
Write-Host "Removing package download from '$ArchivePath'"
|
||||||
|
Remove-Item -Path $ArchivePath -Force
|
17
windows/Install-IPerf3ServerService.ps1
Normal file
17
windows/Install-IPerf3ServerService.ps1
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Create the logs directory if it doesn't already exist
|
||||||
|
if (-not (Test-Path -PathType Container 'C:\Program Files\iperf3\logs')) { New-Item -ItemType Directory -Path 'C:\Program Files\iperf3\logs' | Out-Null }
|
||||||
|
|
||||||
|
$Service = Get-Service -Name iperf3server -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
if ($null -eq $Service) {
|
||||||
|
& "C:\Program Files\nssm\win64\nssm.exe" install iperf3server "C:\Program Files\iperf3\iperf3.exe" "--server --port 5201 --format m --verbose"
|
||||||
|
& "C:\Program Files\nssm\win64\nssm.exe" set iperf3server DisplayName "iPerf3 Server" | Out-Null
|
||||||
|
& "C:\Program Files\nssm\win64\nssm.exe" set iperf3server Description "iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks." | Out-Null
|
||||||
|
& "C:\Program Files\nssm\win64\nssm.exe" set iperf3server AppStdout "C:\Program Files\iperf3\logs\service.log" | Out-Null
|
||||||
|
& "C:\Program Files\nssm\win64\nssm.exe" set iperf3server AppStderr "C:\Program Files\iperf3\logs\service.log" | Out-Null
|
||||||
|
|
||||||
|
Write-Host "Starting service..."
|
||||||
|
Start-Service -Name iperf3server
|
||||||
|
} else {
|
||||||
|
Write-Host "Service is already installed."
|
||||||
|
}
|
45
windows/Install-Nssm.ps1
Normal file
45
windows/Install-Nssm.ps1
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
$PackagesPath = 'C:\Packages'
|
||||||
|
$DestinationPath = 'C:\Program Files\nssm'
|
||||||
|
|
||||||
|
$InstallerUrl = 'https://nssm.cc/ci/nssm-2.24-103-gdee49fc.zip'
|
||||||
|
|
||||||
|
$ArchivePath = Join-Path -Path $PackagesPath -ChildPath ($InstallerUrl | Select-String -Pattern "(nssm-(?:\d\.?)+-\d.*\.zip)").Matches.Value
|
||||||
|
|
||||||
|
# Exit if the application is already installed
|
||||||
|
if (Test-Path $DestinationPath) { Write-Host 'NSSM is already installed.'; exit }
|
||||||
|
|
||||||
|
# Prep
|
||||||
|
|
||||||
|
# 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 }
|
||||||
|
|
||||||
|
# Download
|
||||||
|
|
||||||
|
Write-Host "Downloading application..."
|
||||||
|
# Use Legacy WebClient for compatibility
|
||||||
|
(New-Object Net.WebClient).DownloadFile($InstallerUrl, $ArchivePath)
|
||||||
|
|
||||||
|
# Extract
|
||||||
|
|
||||||
|
$ExpandedPath = $ArchivePath -replace '.zip',''
|
||||||
|
|
||||||
|
Write-Host "Extracting application..."
|
||||||
|
Expand-Archive -Path $ArchivePath -DestinationPath $PackagesPath -Force
|
||||||
|
Write-Host "Application extracted to $ExpandedPath"
|
||||||
|
|
||||||
|
# Install
|
||||||
|
|
||||||
|
Write-Host "Installing application..."
|
||||||
|
if (-not (Test-Path -PathType Container $DestinationPath)) { New-Item -ItemType Directory -Path $DestinationPath | Out-Null }
|
||||||
|
Move-Item -Path "$ExpandedPath\*" -Destination $DestinationPath
|
||||||
|
|
||||||
|
# Add the DestinationPath to Path system environment variable
|
||||||
|
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$DestinationPath\win64\", [System.EnvironmentVariableTarget]::Machine)
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
|
||||||
|
Write-Host "Removing package download from '$ArchivePath'"
|
||||||
|
Remove-Item -Path $ArchivePath -Force
|
||||||
|
Remove-Item -Path $ExpandedPath -Recurse -Force
|
8
windows/Uninstall-IPerf3ServerService.ps1
Normal file
8
windows/Uninstall-IPerf3ServerService.ps1
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
$Service = Get-Service -Name iperf3server -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
if ($null -eq $Service) {
|
||||||
|
Write-Host "Service is not installed"
|
||||||
|
} else {
|
||||||
|
& "C:\Program Files\nssm\win64\nssm.exe" stop iperf3server
|
||||||
|
& "C:\Program Files\nssm\win64\nssm.exe" remove iperf3server
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user