major change to override Write-Error func
This commit is contained in:
@@ -3,21 +3,21 @@
|
||||
If ( Test-Path "${Env:ProgramFiles(x86)}\MspPlatform\PME\unins000.exe" ) {
|
||||
Write-Output "Uninstalling N-Central Patch Management Service Controller"
|
||||
Try { Start-Process "${Env:ProgramFiles(x86)}\MspPlatform\PME\unins000.exe" -ArgumentList "/SILENT" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove N-Central File Cache Service Agent
|
||||
If ( Test-Path "${Env:ProgramFiles(x86)}\MspPlatform\FileCacheServiceAgent\unins000.exe" ) {
|
||||
Write-Output "Uninstalling N-Central File Cache Service Agent"
|
||||
Try { Start-Process "${Env:ProgramFiles(x86)}\MspPlatform\FileCacheServiceAgent\unins000.exe" -ArgumentList "/SILENT" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove N-Central Request Handler Agent
|
||||
If ( Test-Path "${Env:ProgramFiles(x86)}\MspPlatform\RequestHandlerAgent\unins000.exe" ) {
|
||||
Write-Output "Uninstalling N-Central Request Handler Agent"
|
||||
Try { Start-Process "${Env:ProgramFiles(x86)}\MspPlatform\RequestHandlerAgent\unins000.exe" -ArgumentList "/SILENT" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove Windows Software Probe
|
||||
@@ -25,14 +25,14 @@ If ( Test-Path "${ProgramFiles(x86)}\N-able Technologies\Windows Software Probe\
|
||||
$ProductCode = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\N-able Technologies\Windows Software Probe").ProductCode
|
||||
Write-Output "Uninstalling Windows Software Probe"
|
||||
Try { Start-Process "msiexec.exe" -ArgumentList "/X {${ProductCode}} /qn" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove Windows Agent
|
||||
If ( Test-Path "${ProgramFiles(x86)}\N-able Technologies\Windows Agent\" ) {
|
||||
Write-Output "Uninstalling N-Central Windows Agent"
|
||||
Try { Start-Process "msiexec.exe" -ArgumentList "/X{F5873D07-85EE-4010-A461-B60989884B1C} /qn" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove NablePatchRepositoryService
|
||||
@@ -42,7 +42,7 @@ If ( $Service.Length -gt 0 ) {
|
||||
Control-Service -Stop -Name $ServiceName
|
||||
Write-Output "Deleting the service: ""${ServiceName}"""
|
||||
Try { Start-Process "sc" -ArgumentList "delete ${ServiceName}" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove Windows Software Probe Maintenance Service
|
||||
@@ -52,7 +52,7 @@ If ( $Service.Length -gt 0 ) {
|
||||
Control-Service -Stop -Name $ServiceName
|
||||
Write-Output "Deleting the service: ""${ServiceName}"""
|
||||
Try { Start-Process "sc" -ArgumentList "delete ${ServiceName}" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove Windows Software Probe Syslog Service
|
||||
@@ -62,7 +62,7 @@ If ( $Service.Length -gt 0 ) {
|
||||
Control-Service -Stop -Name $ServiceName
|
||||
Write-Output "Deleting the service: ""${ServiceName}"""
|
||||
Try { Start-Process "sc" -ArgumentList "delete ${ServiceName}" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove Windows Software Probe Service
|
||||
@@ -72,7 +72,7 @@ If ( $Service.Length -gt 0 ) {
|
||||
Control-Service -Stop -Name $ServiceName
|
||||
Write-Output "Deleting the service: ""${ServiceName}"""
|
||||
Try { Start-Process "sc" -ArgumentList "delete ${ServiceName}" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove Windows Agent Maintenance Service
|
||||
@@ -82,7 +82,7 @@ If ( $Service.Length -gt 0 ) {
|
||||
Control-Service -Stop -Name $ServiceName
|
||||
Write-Output "Deleting the service: ""${ServiceName}"""
|
||||
Try { Start-Process "sc" -ArgumentList "delete ${ServiceName}" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove Windows Agent Service
|
||||
@@ -92,31 +92,31 @@ If ( $Service.Length -gt 0 ) {
|
||||
Control-Service -Stop -Name $ServiceName
|
||||
Write-Output "Deleting the service: ""${ServiceName}"""
|
||||
Try { Start-Process "sc" -ArgumentList "delete ${ServiceName}" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove "MspPlatform" directory
|
||||
If ( Test-Path "${Env:ProgramFiles(x86)}\MspPlatform" ) {
|
||||
Write-Output "Forcefully removing ""${Env:ProgramFiles(x86)}\MspPlatform"""
|
||||
Try { Remove-Item "${Env:ProgramFiles(x86)}\MspPlatform" -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove "N-able Technologies" directory
|
||||
If ( Test-Path "${Env:ProgramFiles(x86)}\N-able Technologies" ) {
|
||||
Write-Output "Forcefully removing ""${Env:ProgramFiles(x86)}\N-able Technologies"""
|
||||
Try { Remove-Item "${Env:ProgramFiles(x86)}\N-able Technologies" -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Remove "N-able Technologies" registry key
|
||||
If ( Test-Path "HKLM:SOFTWARE\Wow6432Node\N-able Technologies" ) {
|
||||
Write-Output "Forcefully removing ""HKLM:SOFTWARE\Wow6432Node\N-able Technologies"""
|
||||
Try { Remove-Item "HKLM:SOFTWARE\Wow6432Node\N-able Technologies" -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
If ( Test-Path "HKLM:SOFTWARE\N-able Technologies" ) {
|
||||
Write-Output "Forcefully removing ""HKLM:SOFTWARE\N-able Technologies"""
|
||||
Try { Remove-Item "HKLM:SOFTWARE\N-able Technologies" -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user