Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is there a way to see if a service is stopped or started

Status
Not open for further replies.

bct10

Technical User
May 3, 2004
37
US
is there a way in a script to see if a service is ruuning or stopped for example i like to know if alert isrunning or stopped thaks for any help
 
you may want to consider the ADSI way

Set COmputer = GetObject("WinNT://DOmainNAme/COmputerName,computer")
Set Service = Computer.GetObject("service","ServiceNameHere")
Wscript.Echo Service.Status
1, stopped
4, running

or
Set COmputer = GetObject("WinNT://DOmainNAme/COmputerName,computer")
Computer.Filter = Array("service")
For Each Service In Computer
Wscript.Echo Service.Name & " " & Service.Status
Next
 
hi mrmovie
what would the line
Set COmputer = what should be after the = the pc name or services name thanks for any help

 
it would be as the string suggests,,,the DomainName followed by the ComputerName
 
strDomainNAme = "DOMAIN_X"
strComputerName = "BRA6578C"
Set Computer = GetObject("WinNT://" strDomainName & "/" & strComputerName & ",computer")


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top