Manage Plug-and-Play devices from the command line

Manage Plug-and-Play devices from the command line
Serdar Yegulalp

Rather than use a Windows Scripting Host script to manage hardware through the Device Manager window, it makes more sense to use a command-line program that can let you perform all of the same functions and more -- and more elegantly.

DevCon is a command-line utility from Microsoft that is designed to do exactly that. It is available for Windows 2000 and Windows XP in both 32- and 64-bit versions (packaged together) and can be downloaded from the following URL:

Requires Free Membership to View


You can see the complete command set for DevCon by typing devcon help at the command line, but for your convenience here is a run-through of the major commands.

devcon find *

List all the attached devices on the local machine.

devcon find pci*

List all attached PCI devices.

devcon classes

Lists all setup classes, such as USB controllers, modems, monitors, etc.

devcon listclass <classname>

Lists all devices of a specific class, or all classes if you omit <classname>.

devcon find =<classname> <ID string>

Find any devices of the following classname and with the matching ID string. The ID string can use wildcards, so if you entered *, all devices matching the class would be returned; if you used *PCI*, all devices with "PCI" in the hardware ID string would be returned. The ID string is optional.

devcon findall =<classname>

Finds all devices that match the given classname (or just all devices, period, if you omit <classname>), including devices that have been unplugged, removed, switched off or ejected.

devcon status @<ID_string>

Shows the status of all devices that match the listed ID string. The ID string can contain wildcards, so @PCI* would match anything with PCI in the ID string.

devcon resources =<class>

Lists the resources used by all devices in a given class.

devcon driverfiles =<class>

Shows the names of the driver files used by all devices with the given class.

devcon stack =<class>

Shows the driver stack for the devices with the given class.

devcon drivernodes @<ID_string>

List all compatible drivers for the matching device ID.

devcon remove @<ID_string>

Lets you remove a specific device or all devices that match a given string.

devcon rescan

Scan for new Plug and Play devices.

devcon update <infofile> <ID_string>

Updates hardware that is an exact match for the listed ID with a new .INF driver file. This only affects the exact device listed and not any child devices that may be attached to it.

devcon -r <commands>

-r before any command set will reboot the machine after the command has completed.

devcon disable <ID_string>
devcon enable <ID_string>
devcon restart =<ID_string>

Disables, restarts or enables devices that match the listed ID string.

devcon -m:\<remote_machine> <commands>

Use DevCon to examine a networked machine that allows an IPC pipe connection. You can use any set of commands with the -m option.

The complete documentation for this command can be found in the Microsoft Knowledge Base under article Q311272.

Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter.

This was first published in April 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.