Under Windows XP at least, you use the Windows Driver Kit utility, Device Console Utility (Devcon.exe)

C:\>C:\WDK\devcon remove *SMS_DISPLAY
ROOT\*SMS_DISPLAY\0000                                      : Removed on reboot
Not all of 1 device(s) removed, at least one requires reboot to complete the operation.

C:\>

(in the above example, I’m removing a Disabled SMS Mirror Device)

The DevCon remove command:

Remove devices that match the specific hardware or instance ID.
This command will only work for local machine.
Specify -r to reboot automatically if needed.
Examples of <id> are:
*                  – All devices (not recommended)
ISAPNP\PNP0501     – Hardware ID
*PNP*              – Hardware ID with wildcards (* matches anything)
@ISAPNP\*\*        – Instance ID with wildcards (@ prefixes instance ID)
<class> is a setup class name as obtained from the classes command.

You can download a copy of DevCon via here:
Microsoft Technet Wiki: How to Obtain the Current Version of Device Console Utility (DevCon.exe)