I had to remove an application from a server the other day. After the uninstall the application left some of the services behind. The script below will remove the service from the services.msc console.
----------COPY EVERYTHING BELOW THIS LINE---------- 'This script is used to remove a service from Services.msc 'Cheyenne Harden 12.18.06
strComputer = "." strService = inputbox("Type in the service to be removed.") If strService > "" Then strService2 = "'" & strService & "'" Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colListOfServices = objWMIService.ExecQuery _ ("Select * from Win32_Service Where Name = "& strService2 & " ") For Each objService in colListOfServices 'objService.StopService() ' used for testing objService.Delete() Next Else Wscript.Echo "You did not type in a service name." Wscript.Quit End If Wscript.Echo strService & "Removed" ----------COPY EVERYTHING ABOVE THIS LINE----------
PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR SCRIPT!!! To make this script work you will need one things! 1. You will need to have Admin privlidges on the computer.
This information is provided "AS IS" with no warranties expressed or implied.
Advertisements
|