How to Disable Hardware Devices Using Windows Powershell (Video)

Recently, the Windows Surface Laptop 2 shipped with a faulty device driver that suffered from a massive memory leak that was causing widespread bluescreens and crashes. As Microsoft has yet to patch the memory leak, we needed a workaround… quickly. Luckily for us, the workaround was simply to disable the Intersil Ambient Light Sensor until a patch is released ( ). Unfortunately for us, we had multiple remote endpoints and it simply was not feasible to touch every single computer that was affected by the issue. Thankfully, Windows Powershell was up for the task with its nifty disable-pnpdevice cmdlet!

If you find yourself in a similar situation and you need to disable a hardware device on hundreds, or possibly thousands, of remote endpoints, check out the above video for doing so using Powershell. I hope you find it helpful and are able to incorporate the cmdlets into your existing script libraries! If you prefer a written tutorial, the quick steps are below. Thanks and leave any questions in the comments!

Quick Steps for Disabling Hardware Devices Using Powershell

In this example, I will be disabling the Killer Networks E2400 Network Controller.

Step 1: Confirm the device is present and enabled

Get-PnpDevice -FriendlyName "*killer*"

A status of OK indicates the device is enabled. The class, friendly name, and truncated InstanceId is also displayed.

Confirm the device is present and enabled using get-pnpdevice

Step 2: Find the InstanceID of the device

Get-PnpDevice -FriendlyName "*killer*" | ft -wrap -autosize friendlyname, instanceid

This command returns the friendlyname and instanceid without truncating the values.

Use get-pnpdevice to find the instanceid

Step 3: Disable the device using the InstanceID found in step 2

Disable-PnpDevice -InstanceId "PCI\VEN_1969&DEV_E0A1&SUBSYS_E0001458&REV_10\4&325A602&0&00E2" -confirm:$false

Copy the full InstanceId found in step 1 into the disable cmdlet.

use disable-pnp to disable the device using powershell

Step 4: Check your work using Get-PnpDevice

Get-PnpDevice -FriendlyName "*killer*"

A status of ‘Error’ indicates that the device is not enabled. You can also check manually with the device manager.

get-pnpdevice shows the device is disabled

Wrapping Up

If needed, you can re-enable the device by using enable-pnpdevice -instanceid as follows:

Enable-PnpDevice -InstanceId "PCI\VEN_1969&DEV_E0A1&SUBSYS_E0001458&REV_10\4&325A602&0&00E2" -confirm:$false

You can then confirm it is enabled by using get-pnpdevice one more time. A status of ‘OK’ indicates that it is enabled.

Get-PnpDevice -FriendlyName "*killer*"

Use enable-pnpdevice to enable a hardware device using powershell