Using WMI to obtain dependent services (restarting services and all dependent services) 
Author Message
 Using WMI to obtain dependent services (restarting services and all dependent services)

I've been unsuccessfully trying to use WMI to retrieve a list of all
dependent services for a given service.  Eventually, I'd use the info to
restart all effected services, but for now I'd be happy to just list them.
Could somebody please help me with this...

str_ServiceName = "Spooler"

set ServiceSet = GetObject("winmgmts:").ExecQuery("Associators of
{Win32_service.Name = " & Chr(34) & str_ServiceName & Chr(34) & "} Where
AssocClass = Win32_DependentService Role = Dependent" )
For each Service in ServiceSet
    WScript.Echo Service.Name
Next

I could also use a tool to monitor WMI calls on my system, that would
certainly help identify to correct format for commands like this.

Thanks,

Kevan Smith
MCSE, MCP+I, ACT, A+
NT Administrator
Tideworks Technology



Mon, 08 Mar 2004 07:00:35 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How Do You Shut Down Dependent Services?

2. Changing a property in a service using system.management and WMI

3. Services Restart Script?

4. Restarting a service through ASP?

5. Restart Stopped Services

6. Automatically restarting a Windows 2000 service

7. restart services

8. Script to restart NT service???

9. Fiscal Year dependent custom counter

10. Need to create a dependent record at same time as primary

11. Specify the image shown on a dependent frame

12. Assigning record dependent file to an OLE field?

 

 
Powered by phpBB® Forum Software