change the service name as per your requrement. here i mentioned the telnet service. you can check this in services.msc
- Code: Select all
'Windows script to check the service status
'script by praveen & Subash
strComputer = "."
set shell=createobject("wscript.shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where DisplayName = 'Telnet'")
For each objService in colListOfServices
If objService.state = "Running" Then
Msgbox "Telnet service is Running"
Else
MsgBox "Telnet service is in Stopped state"
End if
Next
