GetDeviceProperties

Gets the specified properties of a Plug and Play device. This method was added in Windows 10/Server 2016.

Gets the specified properties of a Plug and Play device. This method was added in Windows 10/Server 2016.

Example

This method retrieves the extended device properties for a plug&play device. You can query the device first, then call the method:

# query a P&P device
# use the gridview to select it, and use the text box on top top filter for 
# keywords like "camera" or "audio"
$device = Get-CimInstance -ClassName Win32_PnPEntity | Out-GridView -Title 'Select Device' -OutputMode Single

# get extended properties for device
$properties = Invoke-CimMethod -MethodName GetDeviceProperties -InputObject $device | Select-Object -ExpandProperty DeviceProperties

# show properties:
$properties | Out-GridView

This method is available via Get-PnPDeviceProperty as well, so you can write:

# query a P&P device
# use the gridview to select it, and use the text box on top top filter for 
# keywords like "camera" or "audio"
$properties = Get-PnPDevice | Out-GridView -Title 'Select Device' -OutputMode Single | Get-PnpDeviceProperty

# show properties:
$properties | Out-GridView

Learn more](/wmi/commands#calling-wmi-methods) about Invoke-CimMethod and invoking WMI methods.

Syntax

Uint32 GetDeviceProperties(
  [in, optional] string                  devicePropertyKeys[],
  [out]          Win32_PnPDeviceProperty deviceProperties[]
);

Parameters

Name Type Description
devicePropertyKeys [String] Name of device property to retrieve. If left blank or undefined, retrieves all properties.

Return Value

Returns a value of type UInt32. Typically, a value of 0 indicates success. The retrieved properties can be found in the property DeviceProperties.

Requirements

To use Win32_PNPEntity, the following requirements apply:

PowerShell

Get-CimInstance was introduced with PowerShell Version 3.0, which in turn was introduced on clients with Windows 8 and on servers with Windows Server 2012.

If necessary, update Windows PowerShell to Windows PowerShell 5.1, or install PowerShell 7 side-by-side.

Operating System

Win32_PNPEntity was introduced on clients with Windows Vista and on servers with Windows Server 2008. The method GetDeviceProperties was introduced on clients with Windows 10 and on servers with Windows Server 2016. Prior to this, you would have used the SetupAPI calls directly:

Install-Module -Name DeviceManagement -Scope CurrentUser -Force

Namespace

Win32_PNPEntity lives in the Namespace Root/CIMV2. This is the default namespace. There is no need to use the -Namespace parameter in Get-CimInstance.

Implementation

Win32_PNPEntity is implemented in CIMWin32.dll and defined in CIMWin32.mof. Both files are located in the folder C:\Windows\system32\wbem:

explorer $env:windir\system32\wbem
notepad $env:windir\system32\wbem\CIMWin32.mof