Step 9: Remove Old Windows Services
Remove old Nodinite v6 Windows Services to prevent conflicts with new IIS-hosted Monitoring Agents.
Prerequisites
- Step 8 completed – v7 Monitoring Agents downloaded and updated
- PowerShell 7 with administrator privileges
Steps
Generate Removal Script
This script is always safe to run — it only generates a second script (Remove-Nodinite-Services.ps1) and makes no changes itself. Review the generated script before executing it.
Important
If you are co-hosting multiple customers or environments on the same server, the generated script will list all Nodinite Windows Services. Before executing it, remove the entries for environments you are NOT updating. For example, if you are updating Test, keep only the Test-related service entries and delete the rest.
Exception — Nodinite Update Service: Do not remove the Nodinite Update Service until the very last Nodinite environment has been removed from the server. Delete its entry from the generated script each time until the final removal.
Use this PowerShell script to generate Remove-Nodinite-Services.ps1. It also captures each service's installation folder and saves them to Nodinite-AgentFolders.txt — this file is used in Step 14 (Final Cleanup) to locate and delete the old folders, wherever they may be on disk.
# Generate script to remove all Nodinite Windows Services
# Also captures installation folder paths for use in Step 14 cleanup
try {
$services = Get-Service | Where-Object { $_.Name -like "Nodinite*" -and $_.Name -ne "NodiniteUpdateService" }
} catch {
Write-Warning "Some services could not be queried. Continuing with available services."
$services = @()
}
$nodiniteServices = @()
$folderPaths = @()
foreach ($service in $services) {
try {
$null = $service.Status
$nodiniteServices += $service
# Capture installation folder from WMI before service is removed
$wmiService = Get-CimInstance Win32_Service -Filter "Name='$($service.Name)'"
if ($wmiService -and $wmiService.PathName) {
$exePath = $wmiService.PathName.Trim('"')
$folder = Split-Path -Parent $exePath
$folderPaths += $folder
}
} catch {
Write-Warning "Skipping service '$($service.Name)' due to permission error."
}
}
# Save unique folder paths to file — used in Step 14 to delete old agent folders
$folderPaths | Sort-Object -Unique | Set-Content -Path "Nodinite-AgentFolders.txt"
Write-Host "Agent folder paths saved to: Nodinite-AgentFolders.txt"
Write-Host "Keep this file — you will use it in Step 14 to remove the old agent folders."
$outputScript = "Remove-Nodinite-Services.ps1"
$header = @"
# Auto-generated script to stop and remove Nodinite Windows services
# Generated on $(Get-Date -Format "yyyy-MM-dd HH:mm:ss")
"@
Set-Content -Path $outputScript -Value $header
foreach ($service in $nodiniteServices) {
$serviceName = $service.Name
$entry = @"
Write-Host "Stopping service: '$serviceName'"
Stop-Service -Name '$serviceName' -Force
Write-Host "Removing service: '$serviceName'"
sc.exe delete '$serviceName'
"@
Add-Content -Path $outputScript -Value $entry
}
Write-Host "Script generated: $outputScript"
Tip
The generated
Nodinite-AgentFolders.txtlists the exact installation paths of all discovered agents. Keep it — Step 14 will use it to delete these folders without you having to hunt them down manually.
Review and Execute
- Open generated
Remove-Nodinite-Services.ps1in text editor - Review services to be removed
- Manually edit if needed to exclude specific services
- Open PowerShell 7 as Administrator
- Run the script:
.\Remove-Nodinite-Services.ps1 - Verify services removed in Services console (
services.msc)
Completion Checklist
- Removal script generated
- Script reviewed for correctness
- Script executed successfully
- All old Nodinite Windows Services removed
- Verified in Services console
-
Nodinite-AgentFolders.txtsaved — used in Step 14 (Final Cleanup)
Next Step
Troubleshooting
Service Removal Fails - "Access Denied"
Problem: sc.exe cannot delete service.
Solution:
- Ensure service is fully stopped
- Run PowerShell as Administrator
- Check no processes are holding service DLLs
- Reboot if necessary and try again
Some Services Still Listed
Problem: After script, some services still appear.
Solution:
- Check Event Viewer for errors
- Manually stop and delete using Services console
- Reboot and verify services don't restart