MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Dependency Walker[Next]: DTREG.EXE
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Tools->DEVCON.EXE

DEVCON.EXE

This is a Microsoft tool described in Knowledge base article "311272". It is available on Windows 2000+. You may also be interested in the Device Driver Installation section of this manual (it lists other possible tools as well).

The DevCon utility is a command line utility that acts as an alternative to Device Manager. Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices. DevCon provides information that is relevant to the developer and is not available in Device Manager.

DevCon is not redistributable (this reduces a nice and useful tool to something with perhaps "some" use). I'm going to assume internal use in your company is not distribution. It is provided for use as a debugging and development tool. You can freely modify DevCon for private use. The sample demonstrates how to use the SetupAPI and CfgMgr32 functions together effectively to enumerate devices and perform device operations. Note that the source is available so you could create your own program based on this.

Example #1 - Install

Note the use of the "^" character to "escape" the ampersand characters in the hardware ID:

devcon install etzkp.inf USB\VID_108C^&PID_0200^&MI_01
devcon install etzkq.inf USB\VID_108C^&PID_0101

Example #2 - Correct Unknown Devices

The following demonstrates the removal of "unknown" devices ("?" in device manager) and if any were found then a hardware scan is performed:

echo off
setlocal
set RemoveFile=Remove.txt
del "%RemoveFile%" >nul 2>&1

@REM *** Remove unknown devices, if any found need a rescan ***
devcon.exe /remove =Unknown > "%RemoveFile%"
type "%RemoveFile%"
find.exe /I "No devices removed" "%RemoveFile%" >nul 2>&1
if errorlevel 1 devcon.exe /rescan


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Dependency Walker[Next]: DTREG.EXE


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.