fix for olde versions of Powershell
This commit is contained in:
@@ -29,11 +29,12 @@ If ( Test-Path "${ProgramFiles(x86)}\N-able Technologies\Windows Software Probe\
|
||||
}
|
||||
|
||||
## Remove NablePatchRepositoryService
|
||||
$Service = Get-Service -Name NablePatchRepositoryService -ErrorAction SilentlyContinue
|
||||
$ServiceName = "NablePatchRepositoryService"
|
||||
$Service = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||
If ( $Service.Length -gt 0 ) {
|
||||
Control-Service -Stop -Name $Service.ServiceName
|
||||
LogMsg "Deleting the service: ""NablePatchRepositoryService"""
|
||||
Try { $Service | Remove-Service }
|
||||
Control-Service -Stop -Name $ServiceName
|
||||
LogMsg "Deleting the service: ""${ServiceName}"""
|
||||
Try { Start-Process "sc" -ArgumentList "delete ${ServiceName}" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user