查看设备
$allDevice="C:\Data\soundDevAll.txt"
(Get-WmiObject -Class Win32_SoundDevice).Name|Out-File $allDevice
device status
$deviceInfo=Get-WmiObject Win32_PnPEntity| select Name, Status | where {$_.Name -like "$deviceName"}
$setFlag=0$compareStatus="Error"
// $compareStatus="OK"if($deviceInfo.Status -eq $compareStatus)
{$setFlag=1
}
window 硬件类查看C#文章
https://blog.csdn.net/winterye12/article/details/74979377