Sunday, January 20, 2013

Creating a Custom boot wim for task Sequence


Creating a Custom boot wim for task Sequence

Many times I have to modify my default Boot.wim file to accommodate my requirements, such as adding tools, utilities and custom scripts. Sometimes I have to check back the reference guide for few commands.
So I thought I will make my own reference guide for myself so I know where to go when needed. So here I am with a simple n easy walkthrough to get a custom Boot.wim or WinPE 3.0. for x64.

In this walkthrough I have used WAIK version 6.1.7600.16385 (Typically Windows 7). If you don’t know how to check what version of WAIK you have installed, Please refer to this how to guide.

First go to Start -> All programs -> Microsoft Windows AIK folder. Select Deployment Tools Command Prompt then choose “Run as administrator”


The following command window will display


Inside the command window run copype.cmd amd64 c:\winpe_amd64
This will create a folder called Winpe_amd64 under C:\ and will copy few files.

Now, Copy the base image (winpe.wim) into \Winpe_xamd64\ISO\sources folder and rename the file to boot.wim.  by  running 
copy c:\winpe_amd64\winpe.wim c:\winpe_amd64\ISO\sources\boot.wim

At this stage we need to mount the boot.wim to mount directory so we can add our own custom stuff. To mount the base wim to mount directory use following command-
Dism /Mount-Wim /WimFile:C:\winpe_amd64\ISO\sources\boot.wim /index:1 /MountDir:C:\winpe_amd64\mount

As shown above the image is mounted to \mount folder. If you want to browse to winpe system 32 folder you can do that by going to C:\winpe_amd64\mount\Windows\System32.

Now, we will add some custom packages to the boot wim by using Add-Package command. This is the first stage of customizing the Boot.wim.

Here I want to add WMI package by using the following command -
Dism /image:C:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\amd64\WinPE_FPs\winpe-wmi.cab”

Next HTA package –
Dism /image:C:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\amd64\WinPE_FPs\winpe-HTA.cab”



Then Scripting package-
Dism /image:C:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\amd64\WinPE_FPs\winpe-Scripting.cab”


Then WDS tools –
Dism /image:C:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\Tools\PETools\amd64\WinPE_FPs\winpe-WDS-Tools.cab”


After adding required packages, you can run dism /image:c:\winpe_amd64\mount /Get-Packages command to see what all got installed. The above command will list all the added packages, but the status will show as pending as we haven’t saved the changes.

Now I want to add my very own customization to the Boot.wim file. This includes few OSD Task Sequence build scripts, Trace32.exe, and OSD++ tool Created by Jason.

First I want to create a separate folder in winpe to copy the stuff we needed by running following command -      md C:\Winpe_amd64\Mount\Windows\System32\Scripts


Above command created a folder called Scripts under  C:\Winpe_amd64\Mount\Windows\System32\Scripts.
We can add all our scripts to this folder by using xcopy or by using copy paste option.
Similar way I have created another folder called OSD under Scripts, then used xcopy to copy the OSD files and related scripts to C:\Winpe_amd64\Mount\Windows\System32\Scripts\OSD.
I have copied Trace32.exe to the root of the C:\Winpe_amd64\Mount\Windows\System32\. Trace32.exe will be handy when we want to view the logs when running in WinPE.



Till now we have added all our customization to the boot.wim. Now it is the time to save the modifications by using a command commit.
Please beware of commit command. Once you run commit you cannot modify the boot.wim. So, if you want to make changes, then it is the time to do it.
Use Dism /unmount-wim /Mountdir:c:\winpe_amd64\mount /commit to commit the changes.


Presto !! You have your own custom boot wim to use with the OSD Task Sequence.
Now you can copy the custom boot.wim file from C:\winpe_amd64\ISO\sources folder and add it to the OSD Task Sequence.


If you want to create a bootable ISO, then type -
Oscdimg -n -bC:\winpe_amd64\Etfsboot.com C:\winpe_amd64\ISO C:\winpe_amd64\winpeamd64.iso



That will create a bootable ISO under C:\winpe_amd64 with a file name winpeamd64.iso


Finally Type Exit to close the “Deployment Tools Command Prompt”.

You can extract this ISO file to any bootable USB keys or CD or DVD. If you want to know how to create a USB bootable follow the steps here

No comments:

Post a Comment