I recently had a customer who couldn’t re image machines because of some hidden partition stuff on manufacture preloaded machines. It actually turned out that a couple of files needed to be removed prior to running the TS. So we added a  script to be run prior to the launch of the TS, to get rid of these files.

Its not like its a big secret, how you do this, as it is in the WinPE.chm but I thought just make small description of the steps anyhow.

1. MountRW SCCM boot.wim with ImageX

ImageX /MountRW C:\boot.wim 1 C:\mount

2. Open C:\mount\windows\system32\winpeshl.ini

3. Change it to look like beneath.

[LaunchApps]

%SYSTEMDRIVE%\windows\system32\PreTS.vbs

%SYSTEMDRIVE%\sms\bin\i386\TsBootShell.exe

4. In C:\mount\windows\system32, create PreTS.vbs with the stuff you want to execute.

5. Unmonut the changed image

– ImageX /unmount /commit C:\mount

6. On your WDS server add the changed boot.wim

 

You could add any number of different tasks to be executed if needed…