Rob van der Woude's Scripting Pages

DEVCON

Command Line Utility Alternative to Device Manager

DEVCON is a Microsoft tool that allows "device management" from the command line.

It is available for free as part of the Windows Driver Kit (a.k.a. WDK).
Unfortunately, it is no longer available as a separate download from Microsoft's websites.
Burn or mount the downloaded WDK ISO image, and either

or More detailed information and command line examples can be found at Microsoft TechNet.

I dedicated this page to DEVCON because I became impressed by its possibilities.
It even allowed me to write scripts to backup drivers without having to search all INF files "manually". This had been on my wish list for a long time.

Another great feature is DEVCON's built-in Reboot command.

Typing DEVCON help or DEVCON /? returns the following help screen:

C:\>DEVCON Help
Device Console Help:

DEVCON.EXE [-r] [-m:\\<machine>] <command> [<arg>...]

-r           Reboots the system only when a restart or reboot is required.

<machine>    Specifies a remote computer. 

<command>    Specifies a Devcon command (see command list below).

<arg>...     One or more arguments that modify a command.

For help with a specific command, type: DEVCON.EXE help <command>

classfilter          Add, delete, and reorder class filters.

classes              List all device setup classes.

disable              Disable devices.

driverfiles          List installed driver files for devices.

drivernodes          List driver nodes of devices.

enable               Enable devices.

find                 Find devices.

findall              Find devices, including those that are not currently attached.

help                 Display Devcon help.

hwids                List hardware IDs of devices.

install              Install a device manually.

listclass            List all devices in a setup class.

reboot               Reboot the local computer.

remove               Remove devices.

rescan               Scan for new hardware.

resources            List hardware resources for devices.

restart              Restart devices.

sethwid              Modify Hardware ID's of listed root-enumerated devices.

stack                List expected driver stack for devices.

status               List running status of devices.

update               Update a device manually.

updateni             Manually update a device (non interactive).

dp_add               Adds (installs) a third-party (OEM) driver package.

dp_delete            Deletes a third-party (OEM) driver package.

dp_enum              Lists the third-party (OEM) driver packages installed on this machine.

 

Type DEVCON help command on the command line for detailed help on command or click a command in the table above to view its help page.

 

The table below lists some of my scripts based on DEVCON, along with the basic command line switches they use.

 

DEVCON Script Examples
💾 Name Description Switches Last Modified
(yyyy-mm-dd)
Remarks
💾 BkAllDrv.bat Backup all Windows 2000 drivers FindAll *
DriverFiles "@hwid"
2004-01-10 The batch, KiXtart and Perl versions can also backup inactive drivers.
The batch and KiXtart versions are much slower.
The batch, KiXtart and Rexx versions will prompt you to download DEVCON itself or RexxUtill (Rexx only) if missing.
The Perl version creates a log file that may help in restores, and an error log, if applicable.
💾 BkAllDrv.kix Backup all Windows 2000 drivers FindAll *
DriverFiles "@hwid"
2004-01-12
💾 BkAllDrv.pl Backup all Windows 2000 drivers FindAll *
DriverFiles "@hwid"
2004-02-14
💾 BkAllDrv.rex Backup all Windows 2000 drivers DriverFiles * 2003-12-30
💾 BkMdmDrv.rex Backup Windows 2000 modem drivers DriverFiles =Modem 2003-12-27 These scripts will prompt you for download if DEVCON isn't found.
💾 BkVidDrv.rex Backup Windows 2000 video drivers DriverFiles =Display 2003-12-28
💾 Drivers.cmd Display all active drivers (Windows as well as OS/2) DriverFiles * 2005-09-21 Uses RMVIEW and CUT in OS/2 Warp
💾 ExpPrnDr.bat Export Printer Drivers DriverFiles =Printer 2009-12-16 This script will prompt you for download if DEVCON isn't found.
💾 GetDevDJ.bat Check if a HP DeskJet printer is installed Find * 2002-03-30  
💾 GetDeviceClassGUID.bat List Device Interface GUID(s) for the specified Device Class Find =class 2024-02-27  
💾 GetDevLT.bat Check if a Logitech mouse is installed Find * 2002-03-30  
💾 GetDevSB.bat Check if a Creative Sound Blaster is installed Find * 2002-03-30  
💾 HardDisk.bat List harddisks, their interfaces and revision numbers for any computer on the network Find =DiskDrive 2005-01-15 This script will prompt you for download if DEVCON isn't found.
💾 ListHDDs.bat List all physical harddisk models on a remote PC Find =DiskDrive SCSI\DISK* 2009-11-24 Requires either WMIC or DEVCON; if neither is available, you will be prompted to open the DEVCON download page
💾 Modems.bat List all modems and the resources they use Resources =Modem 2003-12-23 This script will prompt you for download if DEVCON isn't found.
💾 RenewUSB.bat Remove all USB devices and then rescan for new ones
(obsolete, use ResetDevices.bat instead for Windows Vista and later)
FindAll =USB
FindAll USB*
Remove "@hwid"
Rescan
2017-01-16 Warning: May cripple your OS, use entirely at your own risk, and only after making a full backup.
I had to run this script twice before my computer accepted my new USB stick.
This script will prompt you for download if DEVCON isn't found.
💾 ResetDevices.bat Remove disconnected devices Find
FindAll
Remove "@hwid"
2017-01-16 Warning: May cripple your OS, use entirely at your own risk, and only after making a full backup.
No prompt for confirmation!

This script will prompt you for download if DEVCON isn't found.
💾 RestartMouse.bat Restart a mouse that suddenly hangs, when plugging in a new mouse doesn't help Remove =mouse
Rescan
2022-12-04  
💾 RmHidDev.bat Remove all hidden (inactive) plug&play devices
(obsolete, use ResetDevices.bat instead for Windows Vista and later)
Find *
FindAll *
Remove "@hwid"
2006-11-10 Warning: May cripple your OS, use entirely at your own risk, and only after making a full backup.
Written to remove "ghost devices" from Ghost images.
This script will prompt you for download if DEVCON isn't found.
💾 ShowPRN.bat List all printers and their printer ports FindAll =Printer 2004-01-17 These scripts will prompt you for download if DEVCON isn't found.
💾 ShowPRNT.bat List all printers and their printer ports in tab delimited format FindAll =Printer 2004-01-17

 

Examples of DEVCON commands:
 
DEVCON Classes     List all available classes; may come in handy if you want to start writing your own DEVCON batch files.
DEVCON DriverFiles =USB   List drivers for all USB devices.
DEVCON Findall =USB   List USB devices, even the ones that aren't currently connected (without the drivers, though).
DEVCON Reboot     Reboot the computer.
DEVCON Status =Image     List status of all active imaging devices.
FOR /F %%A IN (
    'DEVCON FindAll ˆ=Image ˆ| FIND "\"'
) DO DEVCON Status "@%%A" | FIND "  "
    List status of all imaging devices, including inactive ones.

 

 


page last modified: 2024-02-27; loaded in 0.0014 seconds