'Gets the list of services on a computer that are set to automatic and stopped but do not exist in the script's hardcoded list: arrayServiceExclusions. Cocobolo Software, LLC June 2015 'usage: cscript.exe StoppedAutoServices.vbs COMPUTERNAME 'the first argument from the command line is assigned to strComputer strComputer = WScript.Arguments(0) 'create an array containing the list of service display names to exclude from the check for stopped automatic services. arrayServiceExclusions = Array("Microsoft .NET Framework NGEN v4.0.30319_X86","Microsoft .NET Framework NGEN v4.0.30319_X64","Google Update Service (gupdate)","Multimedia Class Scheduler","Software Protection","Skype Updater") strStoppedAutoServicesList = "" intCounter = 0 on error resume next Err.Clear Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 'Get list of running services Set colService = objWMIService.ExecQuery("Select * from Win32_Service") For Each objService in colService If ((objService.StartMode = "Auto") And (objService.State = "Stopped")) Then boolIsServiceContainedInList = 0 'loop through our hardcoded list and compare For Each strServiceName in arrayServiceExclusions If objService.DisplayName = strServiceName Then boolIsServiceContainedInList = 1 End If Next 'if a service is set to automatic and in the stopped state and NOT contained in our hardcoded list, then add it to our final report and increment the counter If boolIsServiceContainedInList = 0 Then strStoppedAutoServicesList = strStoppedAutoServicesList & vbLf & objService.DisplayName intCounter = intCounter + 1 End If End If Next 'write the results list to the console WScript.Echo strStoppedAutoServicesList 'exit the script with the return value as the number of items in our list Wscript.Quit(intCounter)