Automating USB Failure recovery using PnPutil: Interactive Technology Support

Philip Clarke

TL;DR: Ultimately, this is a technical ‘How-to Guide’ so if you’re here for the technical detail on controlling USB devices, jump to here, otherwise, enjoy the introduction!

As part of Hamilton Robson's visitor attraction team, I've worked on several interesting creative technology projects. Recently I’ve been working closely with our growing support team to make updates easier, reduce energy use and overall minimize downtime for our customers.

Interactive technology is some of the hardest infrastructure we manage globally. Among our clients, one operates a high-end IP studio tour, packed with rich interactive game-like experiences. As part of this work, we have automated numerous elements of their infrastructure including health checks and real-time monitoring to ensure energy-efficient usage.

Developing experiences that understand the way a human is moving or controlling an experience through a theatrical prop are core capabilities for interactive technology. However, these often are also the most complex parts.

An example of an interactive prop is our interactive longbow and for the last generation of human motion solutions, Microsoft’s Kinect for Azure is our go-to hardware.

The Microsoft Kinect may be familiar to some as a millennial gaming accessory for Microsoft’s Xbox product, but the ‘for Azure’ version is different- aimed at robotics and IOT markets and quite capable. As we have scaled our interactive technology support, we've found that the Kinect for Azure can occasionally falter with frequent turning off & on. Issues often revolve around the USB connection with a range of USB-related failures.

While some can be resolved with a simple restart, others persist and, at first glance, appear only to be rectifiable by physical intervention, a hindrance for large-scale operations. Thankfully, Windows (most interactive technology experiences run on windows) has some low-level USB tools.

Now onto the technical bit on how we solved it - Enter Devcon.

Devcon is a legacy windows command line tool for all things low-level USB. It was the go to windows 8 and there is a decade of internet discussions on USB issues that talk about utilising it. However, official support for it is currently phasing out.

While it is straight forward to use, it isn’t easy to get running on more recent versions of Windows, which is a dealbreaker for our projects. However, Devcon may work for you and can be found here.

We recommend using another tool, PnPUtil instead.

PnPUtil is a command line tool brought in to replace Devcon and is installed by default on newer Windows. For our use case we needed control over the USB hardware and as some older versions of PnPUtil only have functions for driver actions, it meant some crucial features for USB device diagnostics.

You can check what version you have using the command below in Windows Powershell:

pnputil /?


If your pnputil version doesn’t contain commands for devices specifically e.g. /enable-device, /disable-device etc then your windows version is too old. The only work around for this at the moment is to install a more current version of windows to the device in question and this will give you a correct version of pnputil.





Once you have confirmed this, you should have capability to programmatically restart a USB device.

Interesting commands are /enable-device, /disable-device, /restart-device and are simple to use e.g.:

pnputil /restart-device <Device-Instance-ID>

Worked Example

Each USB device command needs a target device id to be specified. There are pnputil commands for finding ‘device instance ids’, but to keep it simple for a worked example, we will use the Windows device manager to get the id.

The USB device I’m interested in is the “Azure Kinect Depth Camera”.

  1. Using Windows 10 or above, open “Device Manager”
  2. Locate a device that relates to your USB device in my case “Azure Kinect Depth Camera” appears under the “Universal Serial devices”
  3. Universal

  4. Right click on the device and select “Properties”
  5. Select the “Details” tab from the top
  6. Then from the property drop down list select “Device Instance Path” and you’ll have a device instance ID value displayed


As you can see a portion of the device instance ID refers to the VID value.


This is commonly a unique identifier for the USB device but be warned, device manufactures, can do anything they want with these IDs.

If you are interested in a USB device that doesn’t show up in the device manager with an obvious name, you can inspect the USB device tree while the device is unplugged and then once it is plugged in, you can get the ID of the device that is new.

Sometimes complex USB devices appear to the device manager as an array of USB devices and the device you actually need to restart may not be obvious.

If this is the case, the following command, based on the USB Vendor ID ‘VID’ will show all the USB devices from that vendor, and can be used to search for the key sister or parent device you need to actually restart.

In this example we use the VID from the Kinect 4K Camera (‘VID_045E’) in the device manager to find all the sister devices of the Kinect:

Get-WmiObject Win32_PnPEntity | Where-Object {$_.PnPDeviceID -like "*VID_045E*"} | Select-Object Caption, PnPDeviceID

Above, the ‘*’ in front of our VID query allows us to ‘wildcard’ match the VID with anything before or after it.


In this example, here is the full list of device Instance IDs associated with our Kinect 4K camera device. Restarting the correct device is important as the wrong one will have no effect or have unpredictable effects. In this example case just we needed the ID associated with the Azure Kinect Depth Camera – ‘USB\VID_045E&PID_097C\000621513112’

Restarting this specific USB device is:

pnputil /restart-device “USB\VID_045E&PID_097C\000621513112”

The Final Boss

We found PnPutil sufficient to fix most USB issues and I have continued to develop scripts around these techniques to automate device discovery and some other edge cases but in time we’ve discovered the need for an occasional manual USB unplug->re-plug is still sometimes required.

After a series of rigorous tests we’re confident these issues are something more electrical related to the USB host controller hardware. Ultimately it’s something we can’t seem to control with PnPutil.

For this final set of electrical related issues, we developed a hardware tool that enabled us to automate the disconnects and reconnect USB hardware (electrically), completely remotely – something we now include as standard for any complex interactive USB hardware and compliments our wider support service.

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on email


Want to find out how the subject of this blog could help your business? 

Our blended team of experts go over and above with our services to our customers, no matter what the challenge. Get in touch to find out how we can work together.