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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to find if service exists.

Status
Not open for further replies.

OrionCookies

Programmer
May 5, 2005
43
0
0
US
Hi,
simple question for you guys.
trying to find way to get if service exists, supposely, service name :EventLog

thanks in advance...
 
use the following:

'*****
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service where name='eventlog'")

For Each objService in colRunningServices
Wscript.Echo objService.DisplayName & VbTab & objService.State
Next
'*********

hth
sg284
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top