Adding BranchCache to WinPE

Before you can use BranchCache in WinPE you need to generate a WinPE image that contains the services and binaries to enable this magic.

Note: If changing or updating the boot image is a major blocker, please contact us.

Generating a BranchCache enabled WinPE Boot Image

Generating a new WinPE Boot Image is done via a command line utility. This utility requires you to have administrator rights on the machine where you run the tool. The reason for this is that it mounts registry hives from the offline media, a privilege that requires administrative rights. In a locked down environment this can be run on a standalone non domain joined computer.

The WinPE images created can then be used as regular boot images in Configuration Manager or MDT (with Config Manager). This makes no difference to these processes, they simply have the inbuilt BranchCache & BITS functionality available if called upon.

Figure 1 shows WinPE images that have been enabled with BranchCache imported into Configuration Manager, ready for use.

The tool used to create a BranchCache enabled image (WinPEGen.exe) is simply run from the command line as shown below.

Figure 2 shows the generator tool command line help output.

WinPE Generator Command Line Options

The generator has the following mandatory configuration parameters:

  • "Source.wim" – The full path and name of the OS source .wim file to use to get resource data.

  • Index – The index number of the source.wim to use - Professional or Enterprise.

  • "Boot.wim" – The full path and name of an existing WinPE boot WIM file

NOTE: The Boot.wim file is modified during this process, so ensure you have a backup!

  • Index – The index number of the wim to use inside the .wim file, like DISM /Index:1 etc.

The following optional configuration options may also be provided:

  • /Add-StifleR – Adds the StifleR client to the WinPE image under the %WINDIR%\System32\ path.

The StifleR Client files are added from within the WinPE Generator executable.

  • /Add-StifleROnly – Adds only the StifleR client and does not add BranchCache and BITS to the image.

  • /StifleRConfig – Defines the path to a StifleR client configuration file.

Providing a configuration file is essential in order to provide the StifleR Server name etc.

  • /Remove-BITS - Removes BITS for Bandwidth Policy Aware Downloads in WinPE

  • /Copy-BITSPolicy - Copies the local BITS policy into the WinPE Image

This overwrites the default BITS policy which is limited to 1Mb/s during business hours of Monday-Friday 08:00-17:00 and 2Mb/s during any other time. Ignoring speed limits on the LAN allows full throttle download for cached local content. Use GPEdit to create a local BITS policy which can then be copied automatically at build time.

Boot Image Generation Pre-Requisites

The generator does not need to install anything and stores/mounts temporary files in the %temp% folder of the user running the process.

  • A workstation or Server with Windows 7/2008 or higher (x86 or x64) on which to run the process. The User must be a member of the Local Administrators group.

Administrative access is required in order to mount the registry hives in the source and boot media. This is a privileged operation which requires Administrative access to the machine.

  • Access to the 2Pint Software "WinPEGen.exe"

This is freely downloadable from the website as a part of the OSD Toolkit.

  • A boot.wim image that has not been finalized (i.e. still allows changes to be made to it)

This can be acquired either from the Configuration Manager server or MDT or also through the WAIK/AIK directly.

  • Access to Windows source media of either Enterprise or Professional

The media can be either Windows 7 (For Windows 7 versions of WinPE) or Windows 8.x for more up to date WinPE versions. This can be in the form of a DVD or ISO file, it can even be a captured WIM as long as the "Windows" directory exists on one of the indexed images.

NOTE: The Source.wim MUST BE ENTERPRISE media if using /Remove-BITS option, otherwise data transfers will not be BranchCache enabled.

IMPORTANT: The Source.wim MUST be the same release version, i.e. same build, as the Boot WIM that is to be modified. If you have a patched install.wim you need to patch your WinPE image. A script to do this can be found here: OSD Toolkit Downloads Also you have a KB describing how its done:

Although the media does not have to be Enterprise, Professional requires BITS added in order to provide BranchCache functionality. Enterprise media adds native HTTP support for BranchCache.

Running WinPEGen.exe

The "WinPEGen.exe" is available in both x86 and x64 versions.

Start the process by launching a command shell. Navigate in the prompt to the path where the "WinPEGen.exe" file is located.

  1. Run "WinPEGen.exe" without any command line arguments to see the parameters available (as per figure 2 above)

  2. To create an Image, type in the appropriate WinPEGen.exe command line. E.G.:

"WinPEGen.exe" "C:\Temp\Windows8Ent\Sources\install.wim" 1 "C:\Temp\boot.wim" 1

  1. Press Enter to start the process

  2. The Generator will write progress to the screen as it mounts and customizes the boot image, any errors encountered will be visible on the screen.

Example Generation


The following explorer window shows the setup of files in this example. We have copied the x64 generator executable to the C:\Temp\ folder

Source Media File:

Figure 3: Note that the source media can be a DVD image mounted with the Sources\install.wim or any other wim file with the correct architecture, version and folder structure.

Example command line (In this case adding StifleR to the image and defining the (required) path to the StifleR client configuration file):

Figure 4 shows the command line for running the generator.

Hint: If needed you can save the output by redirecting the standard out to a text file with the > character from a prompt. The > characters piping function is a function in cmd.exe so the command prompt must be executed as follows:

Cmd.exe /c "WinPEGen.exe" "C:\Temp\Windows8Ent\Sources\install.wim" 1 "C:\Temp\boot.wim" 1>C:\MyLogfile.txt

Assuming that all goes well, the executable will complete and generate the BranchCache enabled boot.wim file.

Sample output as follows:

Figure 5 shows the completed task of generating the boot images.

The full process of adding the new boot image to your deployment method is out of scope for this document but it is relatively simple. Right click the Boot Image node in Configuration Manager and select "Add Boot Image" and provide the path to your boot image.

Note: If using StifleR in WinPE you must include the Microsoft .NET optional component in your boot image.

Last updated