PowerShell 获取接在电脑上显示器的序列号,支持多个
$Monitors = Get-WmiObject WmiMonitorID -Namespace root\wmi
function Decode {
If ($args[0] -is [System.Array]) {
[System.Text.Encoding]::ASCII.GetString($args[0])
}
Else {
continue
}
}
$result = ForEach ($Monitor in $Monitors) {
$Manufacturer = Decode $Monitor.ManufacturerName -notmatch 0
$Name = Decode $Monitor.UserFriendlyName -notmatch 0
$Serial = Decode $Monitor.SerialNumberID -notmatch 0
$Serial
}
$result -join ","

浙公网安备 33010602011771号