Jump to content

Display Pnpid of Network Controller or unknown device


Recommended Posts

Hi

After searching high and low and finding nothing I have decided to post here I hope some of you may be able to help me. My scenario is, after installing an OS onto a laptop,

either Xp or Win 7 I would like to display the Pnp Device ID (Ven and Dev) of the wireless network controller.

Thanks in Advance.

Borgster

Link to comment
Share on other sites

  • Moderators

My guess is WMI is the most effecient manner for searching this out, see If you really want to do a longer (and more painful) search, the info can be found under HKLMCurrentControlSetControlClass.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Try this:

Global $oErrorHandler = ObjEvent("AutoIt.Error", "ObjErrorHandler")

MsgBox(0, "PNPDeviceIDs on " & @ComputerName, WMI_PNPDeviceID("."))

Func WMI_PNPDeviceID($host, $usr = "", $pass = "") ;coded by UEZ 2012
    If $host = "." Then $host = @ComputerName
    Local $PNPDeviceID
    Local $ping = Ping($host, 1000)
    If @error Then Return SetError(1, 0, -1)
    Local $objWMILocator = ObjCreate("WbemScripting.SWbemLocator")
    Local $objWMIService = $objWMILocator.ConnectServer($host, "rootcimv2", $usr, $pass, "", "", 0x80)
    If @error Then Return SetError(2, 0, -1)
    Local $colItems = $objWMIService.ExecQuery("SELECT Description, PNPDeviceID FROM Win32_NetworkAdapter WHERE Availability=3 AND NetEnabled=True AND Installed=True", "WQL", 0x30)
    If IsObj($colItems) Then
        For $objItem In $colItems
            $PNPDeviceID &= "Device: " & $objItem.Description & ", PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF
        Next
    Else
        Return SetError(3, 0, -1)
    EndIf
    Return $PNPDeviceID
EndFunc

Func ObjErrorHandler()
     ConsoleWrite(  "A COM Error has occured!" & @CRLF  & @CRLF & _
                                "err.description is: "    & @TAB & $oErrorHandler.description    & @CRLF & _
                                "err.windescription:"     & @TAB & $oErrorHandler & @CRLF & _
                                "err.number is: "         & @TAB & Hex($oErrorHandler.number, 8)  & @CRLF & _
                                "err.lastdllerror is: "   & @TAB & $oErrorHandler.lastdllerror   & @CRLF & _
                                "err.scriptline is: "     & @TAB & $oErrorHandler.scriptline     & @CRLF & _
                                "err.source is: "         & @TAB & $oErrorHandler.source         & @CRLF & _
                                "err.helpfile is: "       & @TAB & $oErrorHandler.helpfile       & @CRLF & _
                                "err.helpcontext is: "    & @TAB & $oErrorHandler.helpcontext & @CRLF)
EndFunc

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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...