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
|
## Remove NablePatchRepositoryService
|
||||||
$Service = Get-Service -Name NablePatchRepositoryService -ErrorAction SilentlyContinue
|
$ServiceName = "NablePatchRepositoryService"
|
||||||
|
$Service = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
||||||
If ( $Service.Length -gt 0 ) {
|
If ( $Service.Length -gt 0 ) {
|
||||||
Control-Service -Stop -Name $Service.ServiceName
|
Control-Service -Stop -Name $ServiceName
|
||||||
LogMsg "Deleting the service: ""NablePatchRepositoryService"""
|
LogMsg "Deleting the service: ""${ServiceName}"""
|
||||||
Try { $Service | Remove-Service }
|
Try { Start-Process "sc" -ArgumentList "delete ${ServiceName}" -Wait }
|
||||||
Catch { LogErr $_.Exception.Message }
|
Catch { LogErr $_.Exception.Message }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user