2

Right now, I am getting two separate objects

  1. A Win32_NetworkAdapter WMI object
  2. A Win32_PnpSignedDriver WMI object

In my previous scripts, I've made sure I was calling separate objects, and relating them by the GUID

     $mydev = Get-WmiObject -class Win32_NetworkAdapter | Where-Object {$_.pnpdeviceid -like "*VEN_0000&DEV_00AA*"}

     If ($mydev.GUID -eq $relatedobj.ParentID)
     {
         action
     }

But there is no GUID/ParentID/etc. property for a Win32_PnpSignedDriver object. Is there another way to obtain information about a device's drivers (specifically, the driver version), and also obtain the GUID of the device? Is it possible to do this win the Win32_PnpSignedDriver, and I'm just not seeing it?

EGr
  • 609
  • 4
  • 14
  • 29

1 Answers1

0

I found an easy way around this. I'm not great with the registry, so it was the last place I looked; but using it makes it much easier to find the information I was looking for.

I compare the nic information the same way as in my original post (with the Win32_NetworkAdapter WMI object), but I compare the GUID to the registry value instead. This can be done using the following line to get all nics:

    $nicreg = Get-ChildItem -path "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\" -ErrorAction SilentlyContinue

    foreach ($nic in $nicreg)
    {
        # do stuff with driver versions
    }

And then iterating through each NIC comparing $nic.GetValue("NetCfgInstanceId") to $mydev.GUID. After you have confirmed you are looking at the right nic by verifying the GUID, you can get $nic.GetValue("DriverVersion") for the device you are looking at.

EGr
  • 609
  • 4
  • 14
  • 29