Sorry, that was not clear from you question.
This should do it as long as you make sure it is launch by CSCRIPT and not
WSCRIPT
Dim oWMI, oServices, oService, buffer
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
buffer = ""
Set oServices = oWMI.ExecQuery("SELECT * FROM Win32_Service WHERE StartMode =
'Auto' AND State <> 'Running'")
For Each oService In oServices
buffer = buffer & "," & oService.Name
Next
buffer = Mid(buffer,2)
If buffer <> "" Then WScript.Echo buffer
Jorgie
--
Erik Jorgensen
Support Systems Administrator - Principal
Vended Applications Support Services
Division of IT
University of Missouri - Columbia
[email protected]<https://um-ncas2.um.umsystem.edu/owa/UrlBlockedError.aspx>
573.882.5974
Sent from a Surface Pro with Windows 8.1 Enterprise Update!
From: [email protected] [mailto:[email protected]] On
Behalf Of Haysley, Adam
Sent: Tuesday, January 20, 2015 1:13 PM
To: '[email protected]'
Subject: RE: [msmom] win32_service where startmode = 'auto' AND state !=
'running'
I know how to do the query. I said VBScript because we still have servers that
do not have PowerShell installed.
Question is: How do I get these alerts in SCOM via VBScript?
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Jorgensen, Erik
Sent: Tuesday, January 20, 2015 2:09 PM
To: [email protected]<mailto:[email protected]>
Subject: RE: [msmom] win32_service where startmode = 'auto' AND state !=
'running'
I would do it in PowerShell, like this:
Get-WMIObject Win32_Service |
Where-Object { $_.StartMode -eq 'Auto' -and $_.State -ne 'Running' }
Hope that helps,
Jorgie
--
Erik Jorgensen
Support Systems Administrator - Principal
Vended Applications Support Services
Division of IT
University of Missouri - Columbia
[email protected]<https://um-ncas2.um.umsystem.edu/owa/UrlBlockedError.aspx>
573.882.5974
Sent from a Surface Pro with Windows 8.1 Enterprise Update!
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Haysley, Adam
Sent: Tuesday, January 20, 2015 12:59 PM
To: [email protected]<mailto:[email protected]>
Subject: [msmom] win32_service where startmode = 'auto' AND state != 'running'
I'm sure this has been asked before, but since I am a newbie to SCOM, I will
ask again.
I have been asked to monitor all services that have a startmode = auto and
state != running.
Can this be down in a vbscript so to not put the burden on SCOM and increase
the repeat count on every execution?
Help!!!
Thanks!
Adam
The information contained in this E-mail transmission is
intended only for the use of the individual or entity to whom
it is addressed. It may contain privileged, confidential,
and protected health information.
If you received it in error, you are on notice of its status.
Please notify us immediately by reply e-mail and then please
delete this message from your system. Please do not copy it
or use it for any purposes, or disclose its contents to any
other person. To do so could violate state and Federal
privacy laws. Thank you for your cooperation.
Please contact the sender if you need assistance.
Dedicated to Hope, Healing and Recovery.
The information contained in this E-mail transmission is
intended only for the use of the individual or entity to whom
it is addressed. It may contain privileged, confidential,
and protected health information.
If you received it in error, you are on notice of its status.
Please notify us immediately by reply e-mail and then please
delete this message from your system. Please do not copy it
or use it for any purposes, or disclose its contents to any
other person. To do so could violate state and Federal
privacy laws. Thank you for your cooperation.
Please contact the sender if you need assistance.
Dedicated to Hope, Healing and Recovery.