sanhen Posted March 26, 2007 Posted March 26, 2007 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colServiceList = objWMIService.ExecQuery("Associators of " _ & "{Win32_service.Name='SMTPSVC'} Where " _ & "AssocClass=Win32_DependentService " & "Role=Dependent") For Each objService in colServiceList Wscript.Echo objService.DisplayName Next Change how kind?
MHz Posted March 26, 2007 Posted March 26, 2007 Try this. $Wscript = ObjCreate("WScript.Shell") If Not @error Then $strComputer = "." $objWMIService = ObjGet("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") If Not @error Then $colServiceList = $objWMIService.ExecQuery ("Associators of " _ & "{Win32_service.Name='SMTPSVC'} Where " _ & "AssocClass=Win32_DependentService " & "Role=Dependent") For $objService In $colServiceList $Wscript.Popup ($objService.DisplayName) Next EndIf EndIf
sanhen Posted March 26, 2007 Author Posted March 26, 2007 (edited) Thank you. But let it shows how call on the services? $Wscript = ObjCreate("WScript.Shell") If Not @error Then $strComputer = "." $objWMIService = ObjGet("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") If Not @error Then $colServiceList = $objWMIService.ExecQuery ("Associators of " _ & "{Win32_service.Name='SMTPSVC'} Where " _ & "AssocClass=Win32_DependentService " & "Role=Dependent") For $objService In $colServiceList Local $Data= ($objService.DisplayName) Next EndIf MsgBox(64,"service",$a) EndIf why msgbox error??? Edited March 26, 2007 by sanhen
therks Posted March 26, 2007 Posted March 26, 2007 Because there's no variable $a defined anywhere? Kind of hard to msgbox something that doesn't exist. My AutoIt Stuff | My Github
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now