Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

September 08, 2009 12:00 AM

Use DevCon To Install Device Drivers Remotely

Windows IT Pro
InstantDoc ID #102599
Rating: (2)
Downloads
102599.zip

My company purchased smart card readers for an electronic signature application. To use the smart card readers, drivers needed to be installed. Because we had nearly 500 computers, manually installing the drivers wasn't practical. To save a lot of time and manpower, we used DevCon (devcon.exe). This utility lets you query, load, and remove device drivers from the command line.

DevCon isn't installed by default. You can install it from the Support\Tools directory on the Windows Server 2003 SP1 CD-ROM or download it from the "The DevCon command-line utility functions as an alternative to Device Manager" web page. (This web page also includes helpful information about how to use DevCon.)

The solution we came up with involved putting DevCon and the driver on a share, then using a batch file to install DevCon on each user's computer. I'll describe the steps we took in case you run into a situation in which you have to install a driver on numerous machines.

The first step was to put DevCon and the driver on a share so that they could be copied to users' systems. On the share, we created the carddriver\omnikey and carddriver\devcon directories, giving them Everyone – Read permissions. We put the driver file in the \\mainserver\carddriver\omnikey directory and devcon.exe in the \\mainserver\carddriver\devcon directory.

After the shares were prepared, we turned our attention to finding the hardware ID for the card reader. After some testing we discovered that if you plug in an unknown USB device (such as a smart card reader), click Cancel to close the New Hardware Found wizard, then run DevCon, you can obtain its device ID. The DevCon command we used was

devcon find USB\*

As Figure 1 shows, it produces a list of USB ports and the device IDs of the USB devices connected to those ports.


Figure 1: Sample output from DevCon


In the sample output in Figure 1, I highlighted the important elements. USB\VID_076B&PID_3021 is the hardware ID. Smart Card Reader USB tells us that the hardware's driver hasn't been loaded yet. After loading the driver, this will read CardMan 3x21. (For more information about the various elements in device IDs, see the Reader to Reader article "Use DevCon to Manage Finicky Hardware".)

With the card reader's hardware ID in hand, it was time to write the batch file. UpdateCardDriver.bat, which Listing 1 shows, first checks to see whether the driver is already present. If it exists, the script ends. If it doesn't exist, the batch file copies DevCon to the %systemroot%\system32 directory on the user's computer, uses DevCon to install the card-reader driver, then removes the card reader. Although the card reader is removed, the driver stays in the system. If you don't remove the card reader, another card reader will be added to the system each time the computer restarts.


Listing 1: UpdateCardDriver.bat


UpdateCardDriver.bat needed to be executed on every computer on which we wanted to install the driver. Because we had nearly 500 computers, we chose to use a Group Policy Object (GPO) startup script. (For information about how to add a batch file to a GPO, see the web-exclusive article "Adding Startup Scripts to GPOs".) After restarting their computers, users were able to attach and use the smart card reader hardware on any USB port on their system.

You can download UpdateCardDriver.bat by clicking the Download the Code Here button at the top of the page.

Related Content:

ARTICLE TOOLS

Comments
  • Ed
    3 years ago
    Sep 08, 2009

    Two thoughts. devcon doesn't work or come with Vista.

    There is a bit of a flaw with the batch file. In theory if it finds the .sys file it assumes the driver has been installed. But that may not be the case. Surely if you can install and uninstall the driver with devcon, you can somehow determine a better way of installing the driver.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.