Compare commits

..

2 Commits

Author SHA1 Message Date
9a6b91f3ed Add tests for iPerf3 install 2026-01-23 10:32:31 -05:00
0fd42610fe Add NinjaOne README 2026-01-23 10:32:14 -05:00
2 changed files with 86 additions and 0 deletions

19
rmm/NinjaOne/README.md Normal file
View File

@ -0,0 +1,19 @@
# NinjaOne Automation Scripts
## Install-NinjaOneRmm
Install NinjaRMM
Download and install the NinjaOne RMM agent with the given token.
### Parameters
#### -Token
Specifies the token ID of the Organization Location in which to place the agent once it is installed.
### Examples
```powershell
.\Install-NinjaRmm.ps1 -Token '90a92722-da34-452c-99e0-af8be7fcbf0c'
```

View File

@ -0,0 +1,67 @@
Describe 'Install-IPerf3' {
BeforeAll {
Set-Item function:Install-IPerf3 ([ScriptBlock]::Create((Get-Content -Raw 'windows\Install-iPerf3.ps1')))
}
It 'Has the correct parameters' {
$params = (Get-Command Install-iPerf3).Parameters
$params.ContainsKey('DestinationPath') | Should -Be $true
$params['DestinationPath'].ParameterType.Name | Should -Be 'String'
$params.ContainsKey('ServerService') | Should -Be $true
$params['ServerService'].ParameterType.Name | Should -Be 'SwitchParameter'
}
Context 'Without ServerService parameter' {
It 'Should download and install iPerf3 without errors' {
{ Install-iPerf3 -DestinationPath 'C:\Program Files\iPerf3' } | Should -Not -Throw
}
It 'Should add iPerf3 to the system PATH' {
$env:PATH | Should -Match 'C:\\Program Files\\iPerf3\\'
}
It 'Should create the iPerf3 installation directory' {
Test-Path -Path 'C:\Program Files\iPerf3' | Should -Be $true
}
It 'Should create the iPerf3 executable in the installation directory' {
Test-Path -Path 'C:\Program Files\iPerf3\iperf3.exe' | Should -Be $true
}
It 'Should add a firewall rule for iPerf3' {
$firewallRule = Get-NetFirewallRule -DisplayName 'Allow iPerf3' -ErrorAction SilentlyContinue
$firewallRule | Should -Not -Be $null
}
AfterAll {
# Clean up any existing iPerf3 installation
if (Get-Service -Name iperf3server -ErrorAction SilentlyContinue) {
Stop-Service -Name iperf3server -Force
Remove-Service -Name iperf3server
}
Remove-Item -Path 'C:\Program Files\iPerf3' -Recurse -Force -ErrorAction SilentlyContinue
Remove-NetFirewallRule -DisplayName 'Allow iPerf3' -ErrorAction SilentlyContinue
}
}
Context 'With ServerService parameter' {
It 'Should install iPerf3 as a Windows service when ServerService is specified' {
{ Install-iPerf3 -DestinationPath 'C:\Program Files\iPerf3' -ServerService } | Should -Not -Throw
$service = Get-Service -Name iperf3server -ErrorAction SilentlyContinue
$service | Should -Not -Be $null
$service.Status | Should -Be 'Running'
}
AfterAll {
# Clean up any existing iPerf3 installation
if (Get-Service -Name iperf3server -ErrorAction SilentlyContinue) {
Stop-Service -Name iperf3server -Force
Remove-Service -Name iperf3server
}
Remove-Item -Path 'C:\Program Files\iPerf3' -Recurse -Force -ErrorAction SilentlyContinue
Remove-NetFirewallRule -DisplayName 'Allow iPerf3' -ErrorAction SilentlyContinue
}
}
}