VBScript Windows 2000 server OS - method / property to check status of service ?
i m runnign vbscript on windows 2000 server -
could tell me method / property check status of service ?
thanks.
use win32_service wmi class: http://msdn.microsoft.com/en-us/library/aa394418(vs.85).aspx
for example:
strservice = "servicename"
strcomputer = "."
set objwmiservice = getobject("winmgmts:\\" & strcomputer & "\root\cimv2")
set colitems = objwmiservice.execquery("select * win32_service name='" & strservice & "'",,48)
for each objitem in colitems
blstarted = objitem.started
sstatus = objitem.status
next
wscript.echo "service started: " & blstarted
wscript.echo "service status: " & sstatus
www.operatingquadrant.com
Windows Server > Directory Services
Comments
Post a Comment