VBScript Windows 2000 server OS - method / property to check status of service ?


hi friends,

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

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS