Jump to content

Recommended Posts

Posted

Hi again,

Is there an alternative in AutoIt to use instead of going through WMI? I mean performing certain functions without using WMI. This is because my script fails if the WMI scripting engine in a certain workstation in corrupted. Alternative to the script below would be appreciated. All it does is enumerate all the sound devices in XP including their hardware device PIDs.

Func GetAudioDevices() ;get list of all audio devices
    Dim $results[1]

    If Not IsObj(ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\" & @ComputerName & "\root\CIMV2")) Then
        MsgBox(0, "Error", "Windows WMI scripting engine is corrupted. Please contact your administrator.")
        Exit 0
    Else
        $objWMI = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\" & @ComputerName & "\root\CIMV2")
        $objItems = $objWMI.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL", 0x10 + 0x20)
        For $objItem In $objItems
            $results &= $objItem.PNPDeviceID & " - " & $objItem.Caption & @CRLF
            _ArrayAdd($results, $objItem.PNPDeviceID & " - " & $objItem.Caption)
        Next
    EndIf

    Return $results
EndFunc
Posted (edited)

Maybe via the Windows API >> http://msdn.microsoft.com/en-us/library/dd370840(v=vs.85).aspx OR http://msdn.microsoft.com/en-us/library/dd743844(v=vs.85).aspx

Edit: I did the searching for you & came up with this >>

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Done, was in a rush when I initially posted.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
  • Recently Browsing   0 members

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