我需要獲取連接到我的PC的顯示器的型號和序列號。如果它在Python中實現會更好,但是在powershell中也可以。
1 回答

嚕嚕噠
TA貢獻1784條經驗 獲得超7個贊
我在下面的鏈接中找到了一些信息。溶液使用wmi類,我們可以從監視器中獲取信息,然后對于每個監視器從字段中獲取值并將其寫入文件。
$Monitors = Get-WmiObject WmiMonitorID -Namespace root\wmi
$LogFile = "d:\monitors.txt"
"Manufacturer,Name,Serial" | Out-File $LogFile
ForEach ($Monitor in $Monitors)
{
$Manufacturer = ($Monitor.ManufacturerName|where {$_ -ne 0}|ForEach{[char]$_}) -join ""
$Name = ($Monitor.UserFriendlyName |where {$_ -ne 0}| ForEach{[char]$_}) -join ""
$Serial = ($Monitor.SerialNumberID |where {$_ -ne 0}| ForEach{[char]$_}) -join ""
"$Manufacturer,$Name,$Serial" | Out-File $LogFile -append
}
添加回答
舉報
0/150
提交
取消