This method is definately the best way to universal imaging as far as I can see.
How nice it is to: Just deploy any XP image (sysprepped or not, drivers or not) to any (virtual/real) machine and change some files/registry on the harddisk with a universal tool before you boot from it.
BTW, there are already 2 commercial tools doing this:
-Symantec Restore Anywhere
-Acronis Universal Restore
Their disadvantage is that they only handle massstorage and HAL, but don't handle pnpdrivers and they're add-ons to the company's own image-product. (Ghost, True Image)
BUT: You can also write such a tool yourself. It's not rocket science...
detect the HAL from the following key in BartPE:
HKLM\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000\HardwareID and if that does not exist
HKLM\SYSTEM\CurrentControlSet\Enum\Root\PCI_HAL\0000\HardwareID
If the HAL in the offline image is different from the one detected, then extract the right latest HAL + kernel on the offline image (usually SP2.CAB) and rename them to their proper names in C:\Windows\system32
load the C:\Windows\system32\config\system to a temp hive
empty the "Enum" branch in the loaded hive so it will be filled properly at boot.
detect the Processor vendor from BartPE with:
HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\VendorIdentifier
... if AMD then change the Startvalue of the intelppm service to 4 in the loaded hive, otherwise most AMD's will bluescreen.
So... that's pretty much the HAL detection/changing routine
That HAL script you mention in your link does not work when run from BartPE/WinPE, because it does't handle the registry in the offline image... it's also not always right on the HAL to be installed.
Now for the Mass Storage drivers it's more difficult. But basically comes down to: Detect the PNP-ID of the boot-device, find the correct .inf file on a driver distribution share mounted from BartPE and install the .sys, .cat files in the offline image. AND very important to import the proper entries in the CiriticalDeviceDatabase and Services section of the loaded hive so the pc will not get a bluescreen (7B error). To do this is too much to explain here in detail.
PNP-drivers is easy: detect the PNP-IDS of the hardware (also within BartPE) and find their corresponding .inf files (and .dll, .cat, .sys...etc...) in the extracted BTS driverpacks on a distribution share and throw them in the offile image in a folder i.e. C:\drivers.
If mini-setup or OOBE is set to run because sysprep was the last action taken before capturing the image (See certain: HKLM\System\Setup values) then,
Save the HKLM\System\Setup\Cmdline string value of the to i.e. C:\setup.cmd.
Change the value to "C:\mysetup.cmd"
copy over setupcopyoeminf.exe to C:\
Copy over/or create the C:\mysetup.cmd with the following lines:
C:\setupcopyoeminf C:\drivers
call C:\setup.cmd
del C:\*setup.cmd
del C:\setupcopyoeminf.exe
If sysprep was not used, then mysetup.cmd should be set to run from a runonce entry where also devcon.exe is being injected and a "devcon rescan" is being run from within mysetup.cmd
So...I'm probably forgetting some stuff, but that's basically it. A universal XP (image) changer. Let's make this a BartPE plugin called: "SysWrap" :-)
But hey, besides the obvious sys-admins/deployers, it could also be used for people changing motherboards/computer and wanting to keep their installation, and what about P2V, V2P, P2P, V2V.
For an imaging product I definately would use Vista's WAIK "ImageX" or script it's API "WIMGAPI.DLL"
This post has been edited by Scrapple: 12 July 2006 - 12:06 PM