By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
Manage Plug-and-Play devices from the command line
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:
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.
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.
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.