RescanHardware

(C) Deon van der Westhuysen, 2003

What is RescanHardware?

RescanHardware requests Windows to check for hardware that has been added (or turned on) since the computer was last restarted - like SCSI scanners. It is equivalent to opening Device Manager and selecting "Rescan Hardware".

RescanHardware can also launch an application (e.g. Vuescan) after the hardware rescan is complete.

RescanHardware was developed and tested on Windows XP, but should work on Windows 98 and 2000 as well.

Download RescanHardware.zip

Usage

The basic usage is simply to double-click on RescanHardware.exe. This will open a splash screen; rescan the hardware and exit.

For the advanced features you need to create a custom shortcut or run it from the command line. The supported command line options are as follows:

RescanHardware [/Device:DevInstID] [/ShowTree] [/Run:AppCmdline]

/Device: specifies the Device Instance ID of the node from which to begin the rescan. For example - you may only be interested to scan for new hardware on a specific SCSI adapter. This will make the rescanning a bit quicker. If you add /Device: multiple times each of the specified subtree will be rescanned. If there is no /Device: option on the command line the device tree is rescanned from the root node [safe default value].

/ShowTree opens a dialog displaying the computer's device tree. Clicking on a device in the tree display will show the command line option to rescan that device and its children. Click the Copy to clipboard button to copy the command line option to the clipboard.

/Run: specifies the application name (and optionally command line parameters) of applications to start once the rescan is finished. Multiple applications can be started by adding additional /Run: options.

Examples

RescanHardware
Rescans the entire device tree and then exits.

RescanHardware /Run:C:\Vuescan\Vuescan.exe
Rescans the entire device tree, and starts Vuescan (assuming default install) when the rescan is complete.

RescanHardware /Run:'"C:\Program Files\Adobe\Photoshop 5.0 LE\photosle.exe"'
Rescans the entire device tree, and starts Photoshop 5 LE. Note that if the path to executable contains spaces, it must be enclosed in double-quotes ("). In this case the entire command line (the executable and arguments, if any) must be enclosed in single-quotes ('). Use two single-quotes to include a single-quote within the command line.

RescanHardware /Run:'"C:\Program Files\Adobe\Photoshop 5.0 LE\photosle.exe" Test.BMP'
Rescans the entire device tree, and starts Photoshop 5 LE with Test.BMP as argument.

RescanHardware /ShowTree
Display the computer's device tree.

RescanHardware /Device:"PCI\VEN_9004&DEV_8178&SUBSYS_00000000&REV_00\4&25296D99&0&20F0"
Rescans all devices attached to the SCSI adapter in my PC. The DevInstID value for your computer will be different! Use the /ShowTree option to determine the DevInstID 's for your computer.

Licensing

This application is free for personal use. I would appreciate a postcard or email from you if you are using it. My details are:
  Deon van der Westhuysen
  6 Keurboom Crescent
  Plattekloof
  7500
  Republic of South Africa

  email: deonv@vodacom.co.za

Support and feedback

I am writing this in my free time. You are welcome to drop me an email if you are having problems with it but I cannot promise a speedy response or bugfix.