I have this code which helps find a service is running or not... but i am nor able to export it to an excel sheet.
Code:
---------
OPTION EXPLICIT
DIM strComputer,strServiceName
strComputer = "." ' Local Computer
strServiceName = "ccmexec" ' Windows Update Service
IF isServiceRunning(strComputer,strServiceName) THEN
wscript.echo "The '" & strServiceName & "' service is running on '" & strcomputer & "'"
ELSE
wscript.echo "The '" & strServiceName & "' service is NOT running on '" & strcomputer & "'"
END IF
' Function to check if a service is running on a given computer
FUNCTION isServiceRunning(strComputer,strServiceName)
DIM objWMIService, strWMIQuery
strWMIQuery = "Select * from Win32_Service Where Name = '" & strServiceName & "' and state='Running'"
SET objWMIService = GETOBJECT("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
IF objWMIService.ExecQuery(strWMIQuery).Count > 0 THEN
isServiceRunning = TRUE
ELSE
isServiceRunning = FALSE
END IF
END FUNCTION