1 回答

TA貢獻(xiàn)1784條經(jīng)驗 獲得超7個贊
我在下面的鏈接中找到了一些信息。溶液使用wmi類,我們可以從監(jiān)視器中獲取信息,然后對于每個監(jiān)視器從字段中獲取值并將其寫入文件。
$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
}
添加回答
舉報