操作设备管理器

Posted on 2019-03-14 22:48  努力成长静待花开  阅读(227)  评论(0编辑  收藏  举报

  方法一:

Get-WmiObject -ClassName Win32_PnPEntity|where{$_.status -eq "error"}    #显示被禁用的设备

Get-WmiObject -ClassName Win32_PnPEntity|where{$_.status -eq "error"}|%{$_.Enable()}      #启动被禁用的所有设备

  方法二:

Get-PnpDevice -Status error      #显示被禁用的设备

 Get-PnpDevice -Status error|Enable-PnpDevice  #启动被禁用的所有设备 需输入进行确认