Elderry
Elderry

Reputation: 2072

What's the difference between DeviceID and PNPDeviceID?

MSDN mentions them as:

DeviceID:

Address or other identifying information to uniquely name the logical device.

PNPDeviceID:

Indicates the Win32 Plug and Play device identifier of the logical device.

But I still don't quite understand. For my USB device, their values are the same. Does it means that PNPDeviceID is the DeviceID for Plug and Play devices?

Upvotes: 0

Views: 10887

Answers (1)

JosefZ
JosefZ

Reputation: 30153

The difference is at least in qualifiers (key in particular). Copied from within WMI Explorer:

*DeviceID - String

Qualifiers: CIM_Key, CIMTYPE, Description, key, MappingStrings, MaxLen, Override, read

The DeviceID property is an address or other identifying information which uniquely identifies the USBHub.

PNPDeviceID - String

Qualifiers: CIMTYPE, Description, read

Indicates the Win32 Plug and Play device ID of the logical device.

For more detailed insight, try next PowerShell code snippet:

Get-WmiObject -query "SELECT * FROM meta_class WHERE __class = 'Win32_USBHub'" | 
    Select-Object -ExpandProperty Properties | 
    Where-Object {$_.Name -match "DeviceID"} | 
    ForEach-Object { 
        $_            | Format-Table -AutoSize
        "Qualifiers of $($_.Name):"
        $_.Qualifiers | Format-Table -AutoSize -Wrap
    }

Output:

Name     Value   Type IsLocal IsArray Origin            Qualifiers                       
----     -----   ---- ------- ------- ------            ----------                       
DeviceID       String   False   False CIM_LogicalDevice {CIM_Key, CIMTYPE, key, Mappin...


Qualifiers of DeviceID:

Name              Value IsAmended IsLocal PropagatesToInstance PropagatesToSubclass IsOve
                                                                                    rrida
                                                                                      ble
----              ----- --------- ------- -------------------- -------------------- -----
CIM_Key            True     False   False                False                 True  True
CIMTYPE          string     False    True                 True                 True  True
key                True     False    True                 True                 True False
MappingStrings       {}     False    True                False                 True  True
MaxLen              256     False    True                False                 True  True
Override       DeviceID     False    True                False                 True  True
read               True     False    True                False                 True  True



Name        Value   Type IsLocal IsArray Origin            Qualifiers     
----        -----   ---- ------- ------- ------            ----------     
PNPDeviceID       String   False   False CIM_LogicalDevice {CIMTYPE, read}


Qualifiers of PNPDeviceID:

Name    Value  IsAmended IsLocal PropagatesToInstance PropagatesToSubclass IsOverridable
----    -----  --------- ------- -------------------- -------------------- -------------
CIMTYPE string     False   False                 True                 True          True
read    True       False   False                False                 True          True

Upvotes: 1

Related Questions