How to enable/disable hardware devices using Windows Powershell

Powershell Window displaying results of the Get-PnpDevice command

If you’re working on Windows Server Core or remotely on another computer and don’t have access to the Windows GUI, you might have trouble disabling a faulty or unwanted plug-and-play device. Thankfully Powershell makes it easy to get, enable and disable devices in Device Manager using Get-PnpDevice, Enable-PnpDevice and Disable-PnpDevice

How to query devices

How to enable or disable devices

To enable disable a device, simply pipe the output of Get-PnpDevice to Disable-PnpDevice or Enable-PnpDevice. Please be sure your Get-PnpDevice command is targeting the correct device before piping to avoid accidentally disabling devices you’d rather keep enabled!

You could also output the instance ID to a variable for use later if you’d rather

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.