Sign in to follow this  
Followers 0
sanhen

vbs to au3

4 posts in this topic

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?

Share this post


Link to post
Share on other sites



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

:whistle:

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by sanhen

Share this post


Link to post
Share on other sites

Because there's no variable $a defined anywhere? Kind of hard to msgbox something that doesn't exist.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0