Delen via


Devcon Remarks

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Devcon Remarks

Identifiers

Devcon uses hardware IDs, compatible IDs, and instance IDs to identify devices.

  • A hardware ID is a vendor-defined string that the Plug and Play Manager uses to find the INF file for a device. A device can have one or more hardware IDs.

  • A compatible ID is a vendor-defined string that is more generic than the hardware ID. Devices that use the same INF file can have the same compatible ID. The Plug and Play Manager uses the compatible ID to find an INF file for a device only when it cannot find the hardware ID. However, because the compatible ID is not as reliable as a hardware ID, the system prompts the user for confirmation before installing a device based on a compatible ID match.

  • An instance ID is a string that uniquely distinguishes a device from other devices on the computer. The instance ID of a device is unique only on a computer and can vary between computers and operating systems. The instance ID of most devices is also its registry path in the Enum registry subkey (HKLM\System\CurrentControlSet\Enum).

    In Devcon commands, instance IDs must be prefixed with the at character (@) to distinguish them from hardware IDs and compatible IDs. For example, devcon status root\* searches for hardware IDs or compatible IDs that begin with "root\". However, **devcon hwids @root\\\*** searches for instance IDs (device registry paths) that begin with "root\."

Devcon Search Logic

Devcon identifies devices by their computer name, hardware ID, compatible ID, instance ID, and device setup class.

When an ID or ID pattern (an ID with wildcard characters (*)) is preceded by the at character (@), Devcon searches only the instance IDs of devices for a match. Otherwise, it searches both the hardware IDs and compatible IDs of devices for a match.

When a command includes more than one ID or ID pattern, Devcon returns devices whose IDs match any of the IDs or ID patterns. That is, it assumes an OR between the ID arguments.

For example, devcon hwids *pnp* *mou* returns devices that include either "pnp" or "mou" in their hardware ID or compatible ID.

When a command includes a device setup class, Devcon first limits the search to the setup class and then applies the ID criteria. Devcon returns devices in the class that match any of the ID patterns. That is, it assumes an AND between the class and the IDs and an OR between each of the ID arguments.

For example, devcon hwids =media *pnp* *microsoft* returns devices in the media device setup class that include either "pnp" or "microsoft" in their hardware ID or compatible ID.

Operational Details

  • Classes. Classes are listed in the order that they appear in the registry (alphanumeric order by GUID).

  • Stack. The stack operation displays the expected driver stack for a device. Although the actual driver stack typically matches the expected stack, variations are possible.

  • Classfilter. Devcon will not add a class filter to a class unless the driver is installed as a service, that is, there must be a subkey for the driver in the Services subkey (HKLM\System\CurrentControlSet\Services). This safeguard prevents you from accidentally adding a filter driver that does not exist and, thereby, rendering the system unbootable.

  • Findall. The Findall operation differs from the Find operation, and from other Devcon device enumerations, in that it omits the DIGCF_PRESENT flag when calling SetupDiGetClassDevsEx function. As a result, the Findall display includes phantom devices that are not currently attached to the computer. For more information, see SetupDiGetClassDevsEx in the Windows DDK.

  • Rescan. Rescanning can cause the Plug and Play Manager to install device drivers without warning when it detects new devices. Rescanning can also detect some non-Plug and Play devices, particularly those that cannot notify the system when they are installed, such as parallel-port devices and serial-port devices. As a result, Administrator privileges are required to run rescan commands.

Restart, Reboot, and /r

Devcon provides a method to restart devices, and two methods to restart the operating system.

  • The /r parameter is a conditional restart that restarts the operating system only when a restart is required to make the accompanying operation effective. This parameter is valid only in commands that include a Devcon operation. It can restart the system on a local or remote computer.

    If a system restart is required, Devcon displays a message explaining that you must restart the system to complete the operation. In response, you can use the reboot operation command.

  • The reboot operation forces the operating system to restart. It is valid only on a local computer and it cannot be combined with other operations.

  • The restart operation restarts the specified devices. It is valid only on a local computer and it cannot be combined with other operations. Some devices cannot be started without a reboot. The /r parameter can be used to reboot the operating system if the devices cannot be started without one.

Devcon Return Codes

Devcon returns a numeric (integer) code that can be used in programs and scripts to determine the success of a Devcon command. (For example, return = devcon hwids *). The following table lists and describes the return codes.

Return code Meaning

0

Success

1

Requires reboot

2

Failure

3

Syntax error

See Also

Concepts

Devcon Overview
Devcon Syntax
Devcon Examples
Alphabetical List of Tools
Pviewer Overview
Exctrlst Overview
Apmstat Overview