I'm trying to get this srcipt to ask for the computer to be checked and then the service to check the status of and I've been unable to get it working so far. The following is just the latest non-working version of it.
Thanks in advance for the help!
[!]The AutoSavers![/!]
Thanks in advance for the help!
Code:
On Error Resume Next
Dim strComputer
Dim strService
strComputer = InputBox("Enter the name of the Computer:")
strService = InputBox("Enter the name of the Service:")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service Where Name = strService")
For Each objItem in colItems
Wscript.Echo "Service Name: " & objItem.Name & VBNewLine & "State: " & objItem.State
Next
[!]The AutoSavers![/!]