Here's a quick conversion, I commented-out the Delete part until your ready to try it ... try simply stopping the service first, then go for the big Delete.

Code:

break on

$strComputer = "."
$strService = "Alerter"

$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + $strComputer + "\root\cimv2")

$colListOfServices = $objWMIService.ExecQuery("SELECT * FROM Win32_Service WHERE Name = '$strService'")

For Each $objService in $colListOfServices
$= $objService.StopService()
;$= $objService.Delete()
Next



-Shawn