Jump to content

vbs to au3


Recommended Posts

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?

Link to comment
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:

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...