$ProductID = Get-WmiObject -Class Win32_Product -Filter "Name='ControlUpAgent'" | Select-Object -ExpandProperty IdentifyingNumber $InstallerID = (Get-ChildItem HKLM:\SOFTWARE\Classes\Installer\Products | ForEach-Object { Get-ItemProperty $_ | Where-Object{ $_.ProductName -match 'ControlUpAgent' } }).PSChildName Set-Location HKLM: Set-Service -Name cuagent -StartupType Disabled -Status Stopped (Get-WmiObject -Class Win32_Service -Filter "Name='cuagent'").Delete() Remove-Item -Path HKLM:\SOFTWARE\Smart-X\ControlUp\Agent -Recurse -Force -Confirm:$false Remove-Item -Path HKLM:\SOFTWARE\Wow6432Node\Smart-X -Recurse -Force -Confirm:$false Get-ChildItem HKLM:\SOFTWARE\Classes\Installer\Products | ForEach-Object { Get-ItemProperty $_ | Where-Object{ $_.ProductName -match 'ControlUpAgent' } } | Remove-Item -Recurse -Force -Confirm:$false Get-Item HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders | ForEach-Object{ $_.Property -match "ControlUpAgent" } | Remove-Item -Recurse -Force -Confirm:$false if ($InstallerID) { Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\$InstallerID" -Recurse -Force -Confirm:$false } if ($ProductID) { Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$ProductID" -Recurse -Force -Confirm:$false }