powershell根据设备状态启用设备


$id = (Get-CimInstance Win32_PnPEntity | where caption -match 'Microsoft RemoteFX 图形设备 - WDDM').pnpDeviceID
$ppid = "{0}{1}" -f '@',$id
$wddmstatus = Get-WmiObject -Class Win32_VideoController | Select-Object -ExpandProperty Status
if ( $wddmstatus -eq 'OK' ) 
{
net stop wddm
exit
}
else
{
Set-Location C:\test
.\devcon enable $ppid
Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Restricted -Force
}
本文链接: https://www.pstips.net/powershell-enable-device-by-status.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注