解決方案

解決方案

我有一個實體設備物件名稱,例如“\Device\0000007c”。

在 Windows 7 中,如何找到與該 ID 相對應的設備,而不是在設備管理員中一次瀏覽系統中的每個設備,開啟屬性對話方塊並查看實體設備物件名稱條目?

我發現根據實體設備物件 (PDO) 識別碼在 Windows 中尋找設備但事實證明這是 XY 問題,並沒有回答這個問題。

我嘗試在註冊表(鍵/值/資料)中搜尋字串“0000007c”、“0000007C”和雙字 0x0000007C,但找不到與設備相關的任何內容。

在舊版 Windows 中,您可以從裝置管理員列印完整的報告(然後我可以搜尋該報告),但在 Windows 7 中,裝置管理員不再有此選項。

答案1

解決方案

來自官方文件:

當匯流排驅動程式偵測到子裝置已插入或拔出時,它會通知即插即用 (PnP) 管理員。作為回應,PnP 管理器要求匯流排驅動程式為連接到父設備(即匯流排)的每個子設備建立一個實體設備物件 (PDO)。

來源:WDF 驅動程式的 WDM 概念

要獲取所需信息,請打開命令提示符並執行以下命令:

wmic path Win32_PnPSignedDriver where "pdo like '%0000007c'" get devicename,pdo

進一步閱讀

答案2

如果這是為了一個物理磁碟,您可以使用以下 Powershell Core 腳本行來找出由模糊標識識別的實際磁碟PDO名稱:

# Starting with a PDO name, likely copy-pasta'd from some obscure warning/error message
$pdo_name='\Device\0000005b'

# Step 1
$system_element_dev_id = Get-CimInstance Win32_PnPSignedDriver |
                           ? {$_.PDO -eq $pdo_name} |
                           Select-Object -ExpandProperty DeviceID

# Step 2: Use the proceeds from the above transaction to identify the "Disk Number"
$phys_disk_num = Get-CimInstance Win32_PNPDevice |
                   ? {[string]$_.SystemElement.DeviceID -eq $system_element_dev_id} |
                   Select-Object @{
                     n='disk_number';
                     e={[int]$_.SameElement.DeviceID.replace('\\.\PHYSICALDRIVE','')}
                   } |
                   Select-Object -expand disk_number

# Step 3: Profit! Get the info you were after
Get-PhysicalDisk | ? {$_.DeviceId -eq $phys_disk_num}

範例輸出,其中序號被遮蓋,並且某些列/值被縮寫以避免可怕的水平捲軸:

Num FriendlyName  SerialNumber MediaType CanPool OpStatus HealthStat Usage        Size
--- ------------  ------------ --------- ------- -------- ---------- -----        ----
5   ST16000NM001G ZL123XYZ     HDD       False   OK       Healthy    Auto-Sel 14.55 TB

針對非裝置類型破解上述腳本物理磁碟將留給讀者當作練習。

相關內容