Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Sysprep on Windows XP - clean up non-existent devices

Posted on 2004-05-03
Medium Priority
Last Modified: 2012-08-13

My goal is to have a ghost image that can be restored to a PC with different hardware. Before bothering to test on *different* hardware, I tested sysprep with the *same* hardware first:

(1) used -bmsd to build the mass storage controller sections in sysprep.inf
(2) run sysprep -mini -activated -reboot
(3) Let the mini setup finish upon reboot

The system did come up successfully, but I noticed the boot process was *much* slower. After I logged on, I checked the "Non PnP drivers" in device manager. There were many orphan devices which were not present before sysprep - e.g.  abp480n5, adpu160m (God knows what they are).

In fact, before sysprep there were 32 non-PNP devices; afterwards there were 75 of them. Hence there ware 75-32 = 43 orphans.

I checked the doc and there was a -clean switch that "cleans up critical non-existent devices". I run sysprep with this switch but it appeared to do nothing. These orphans were still there.

My question: how do I remove these orphan devices? (manual one-by-one removal from device manager is not acceptable).

Question by:Gating
LVL 21

Expert Comment

ID: 10975312
This should explain and solve your problem


Hardware devices not installed in Sysprep image

When you use the Microsoft System Preparation tool (Sysprep) to deploy a Sysprep image of Microsoft Windows XP to a computer, some devices may appear in Device Manager as not installed even when the driver for the device exists in the path that is set by the oempnpdriverspath entry in the Sysprep.inf.

If you double-click on a device in Device Manager, you receive the following error message in the Device status box on the General tab:

The drivers for this device are not installed. (Code 28)
Additionally, a yellow exclamation mark appears next to the device when you view it in Device Manager.
This problem occurs when you create a Sysprep image on a computer and then deploy that image to a computer that has the same type of hardware. Any devices that do not have their drivers installed will remain in this state after the deployment of the Sysprep image. The minisetup program that is used by Sysprep does not perform a full Plug and Play re-enumeration of all devices.
Before you run Sysprep to prepare a computer for duplication, remove any devices in device manager that are set to Code 28. To remove these devices, follow these steps:
Click Start, and then click Control Panel.
Double-click Administrative Tools.
Double-click Computer Management.
Click Device Manager.
Locate any device that has a yellow exclamation mark next to it.
Verify that the device status for the device has the error message that is listed in the "Symptoms" section of this article. To do so:
Right-click the device icon.
Click Properties.
The Device status box lists the error message:

The drivers for this device are not installed. (Code 28)
Right-click the device icon, click Uninstall and then click OK.
Repeat steps 5 through 7 for each device that has the Code 28 error message.

Author Comment

ID: 10976127
My situation is entirely different from the one suggested by braincassin.

His situation: After sysprep, some devices have "code 28" (yellow exclamation mark) in device manager.

My situation: After sysprep, no devices had "code 28" error - everything is fine. The only problem was I got *EXTRA* Non plug-and-play devices installed. I saw these devices by choosing "Show Hidden Devices" in the device manager's menu.

At the risk of being too involved, probably I should supply more details:

1. Before sysprep, my Non PNP section in the device manager was very lean: it only contained "virtual" devices. By "virtual" I mean devices that did not correspond to real hardware. e.g. TCP/IP protocol driver, "sygate for NT, wg3n" (installed by sygate firewall), etc.

2. After sysprep, my Non PNP section got extra devices. Most of them corresponded to REAL hardware. For example,  ALI AGP Bus filter, AHA154x (probably some kind of SCSI controller), etc. THey did not exist before sysprep was used.

3. I am confused because the device manager reported these devices were "working properly". I was very sure they were physically not present in my PC. How could they "work properly"?

4. After I tediously removed them one by one from device manager, they came back on the next reboot!

5. My boot time were also increased by 30 seconds. I strongly suspected these extra devices were the cause.

Hope these help.

Expert Comment

ID: 10976408
I have been down this path, and the decision we ,mmadfe was to leave all the drivers as it made the build esaier to support remotely, and if a driver gets corrupted, the driver files are already in place. XP eventually learns to ignore unneeded devices (which is why it boots quicker than W2K)
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 10976656
Hi rhrowson. I think having a copy of driver *files* in my hard disk is one thing; but having *devices* showing up in the device manager is another, especially when it adversely affects the boot time.

You see, having these driver *files* does not affect my boot time. However, having a *device* in device manager *DOES*, because the drivers must be loaded. Moreover, these are orphan devices (as I said before, my PC did not have "AHA154x", "ALI AGP BUS filter etc", "cpqarray", etc), therefore the boot process spent a lot of time in loading drivers and wait for timeout. *THIS* is the problem.

Expert Comment

ID: 10976920
I'll have a look at my master image after deployment and see what it does. I have never noticed this behaviour, but I may have missed it.

Author Comment

ID: 10983190
OK I will answer my own question. I found the answer by experiments and reading the docs.

"sysprep -bmsd" populates sysprep.inf with entries, each of which corresponds to a mass storage controller found in the Machine.inf, Scsi.inf, Pnpscsi.inf, and Mshdc.inf. After that, when you use sysprep normally (without -bmsd switch), all such devices will be created in device manager, so that the next reboot will load *all* such drivers.

In theory, when this next reboot finishes, the "unused" drivers should be automatically cleanup. In practice, they are not. This is why I saw the orphan devices. To clear them, I have to use "sysprep -clean". The best way is to create C:\sysprep\i386\$OEM$ folder. Put there a cmdlines.txt file that reads

"C:\sysprep\sysprep -clean"

Then in the sysprep.inf file, put the line in the [Unattended] section:

This will make sure the orphan files to deleted.

One thing I discovered was that sysprep appended a section named "[SysprepCleanup]" to my sysprep.inf. This section contained all information about what devices should be removed. Provided this section was intact, "sysprep -clean" will do the cleanup for me.

But the tricky part is that C:\sysprep will be automatically deleted after completion. So when I login, I will see no c:\sysprep folder. In particular, I see no sysprep.inf file, so the[SysprepCleanup] section is not there, and "sysprep -clean" has no effect. I must cleanup *while* the sysprep.inf file is still there. This is why I choose to put the command in cmdlines.txt file.

As for the slow boot time, it turned out it was unrelated to these orphan devices. My system had Intel 845 chipset and I was using Intel Application Accelerator. Somehow the sysprep process messed up with the drivers installed by IAA, without warnings shown in the device manager.  I reinstalled it and the boot time was normal again. As to why this occurred, I am still investigating. However I now consider my questions answered by myself.

Thanks for your help guys.


Accepted Solution

Netminder earned 0 total points
ID: 10983340
User resolved; closed, 50 points refunded.

Site Admin

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Disclosure: Use this tutorial only when no other options helps to get Windows XP running without any problems and you don't want to format the drive. The back up of the data is the responsible of the user, however there is a description of how t…
Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
Integration Management Part 2
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question