Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Used in this article: http://obrivki.blogspot.com/2012/07/zabbix-2-low-level-discovery-windows.html
- '
- Sub ServicesList()
- Dim objWMIService, colItems, oServices, objNTInfo
- Set objNTInfo = CreateObject("WinNTSystemInfo")
- ComputerName = lcase(objNTInfo.ComputerName)
- wscript.echo "{"
- wscript.echo " " & Chr(34) & "data" & Chr(34) & ":[" & vbCrLf
- wscript.echo ""
- Set objWMIService = GetObject("winmgmts:\root\cimv2")
- Set colItems = objWMIService.ExecQuery("Select * from Win32_Service",,48)
- For Each objItem in colItems
- ' if (objItem.StartMode="Auto") then
- ' if (objItem.Started=False) then
- wscript.echo "{ "&Chr(34)&"{#SCNAME}"&Chr(34)&":"&Chr(34)& objItem.Name &Chr(34)&", " &Chr(34)&"{#SCCAPTION}"&Chr(34)&":"&Chr(34)&objItem.Caption&Chr(34)&", " &Chr(34)&"{#SCSTARTMODE}"&Chr(34)&":"&Chr(34)&objItem.StartMode&Chr(34)&", " &Chr(34)&"{#SCDISCOVERYFILTER}"&Chr(34)&":"&Chr(34)&objItem.StartMode&"-"&ComputerName&"-"&objItem.Name&Chr(34)&" },"
- ' end if
- ' end if
- Next
- wscript.echo "{ "&Chr(34)&"{#SCNAME}"&Chr(34)&":"&Chr(34)& "NULL" &Chr(34)&", " &Chr(34)&"{#SCCAPTION}"&Chr(34)&":"&Chr(34)&"NULL"&Chr(34)&", " &Chr(34)&"{#SCSTARTMODE}"&Chr(34)&":"&Chr(34)&"NULL"&Chr(34)&", " &Chr(34)&"{#SCDISCOVERYFILTER}"&Chr(34)&":"&Chr(34)&"NULL"&Chr(34)&" }"
- wscript.echo ""
- wscript.echo " ]"
- wscript.echo "}"
- End Sub
- ServicesList()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement