Windows 8 Preview – Howto – Creating a WinPE boot image with .NET Framework and PowerShell

Here is a step-by-step guide to create a x64 bootimage with support for Scripting, WMI, HTA, ADO, .NET Framework 4.0, PowerShell and the DISM cmdlets for PowerShell.

Create the boot image

In this sample you will create a x64 boot image.

  1. Download the Assessment and Deployment Kit (ADK) from MSDN subscribers download
  2. Install ADK by running adksetup.exe, and make sure that Windows Preinstallation Environment is selected (selected by default)
  3. Create the C:\WinPE_x64 folder
  4. Copy the winpe.wim file from C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64 to C:\WinPE_x64
  5. Create the C:\Mount folder
  6. Start the Deployment Tools and Imaging Environment, and mount the boot image using the following command:

    Imagex /mountrw C:\WinPE_x64\winpe.wim 1 C:\Mount

  7. Add the various optional components to the boot image by running the following commands:
cd /d "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs"
dism /image:C:\Mount /add-package /packagepath:"WinPE-Scripting.cab"
dism /image:C:\Mount /add-package /packagepath:"en-us\WinPE-Scripting_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-WMI.cab"
dism /image:C:\Mount /add-package /packagepath:"en-us\WinPE-WMI_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-MDAC.cab"
dism /image:C:\Mount /add-package /packagepath:"en-us\WinPE-MDAC_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-HTA.cab"
dism /image:C:\Mount /add-package /packagepath:"en-us\WinPE-HTA_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-NetFx4.cab"
dism /image:C:\Mount /add-package /packagepath:"en-us\WinPE-NetFx4_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-PowerShell3.cab"
dism /image:C:\Mount /add-package /packagepath:"en-us\WinPE-PowerShell3_en-us.cab"
dism /image:C:\Mount /add-package /packagepath:"WinPE-DismCmdlets.cab"
dism /image:C:\Mount /add-package /packagepath:"en-us\WinPE-DismCmdlets_en-us.cab"
  1. Commit the changes to the boot image by running the following command: Imagex /unmount /commit C:\Mount
  2. Done, you now have 280 MB or so boot image, that you can add to your WDS (PXE) server.

Optional step – create a bootable ISO image.

If you don't have a PXE server or just want to mount an ISO for test, here you find the additional steps to create a bootable ISO.

  1. Create the C:\WinPE_x64\ISO folder
  2. Copy the contents of the C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\Media folder to C:\WinPE_x64\ISO
  3. Create the C:WinPE_x64\ISO\Sources folder

  4. Copy (or move) the winpe.wim file in C:\WinPE_x64 to C:\WinPE_x64\ISO\Sources
  5. Rename the winpe.wim file in C:\WinPE_x64\ISO\Sources to boot.wim
  6. Copy the etfsboot.com file from C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment and Imaging Tools\amd64\Oscdimg to C:\WinPE_x64
  7. Create the bootable ISO by running the following command:

    oscdimg -b"c:\WinPE_X64\etfsboot.com" -n C:\WinPE_X64\ISO C:\WinPE_X64\WinPE_X64.iso

  8. Done, you now have a 330 MB or so ISO.
The PowerShell command window in WinPE – Listing some hardware info using WMI.

/ Johan

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
23 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Admin
Admin
6 years ago

You need to have Windows ADK 8.1 installed, and open a "Deployment and Imaging Tools Environment" command prompt that sets the path to the tools.

/ Johan

Renfel
Renfel
6 years ago

Hi Johan,

I am new to this on building WinPE on Windows 8 and i'm following your steps.

When I issue this command:
Imagex /mountrw C:WinPE_x64winpe.wim 1 C:Mount

I get a message:
'imagex' is not recognized as an internal or external command,
operable program or batch file.

Please help.

Admin
Admin
7 years ago

Hi Magill,

What .exe?

All commands I'm using is part of Windows ADK which is a free download from Microsoft. No source code is available.

/ Johan

magill
magill
7 years ago

REPLY TO: "/ Johan"

is there any chance you could share your code for that .exe? Where I work I could very possibly use this but due to your typical in-house restrictions something like this running in a production environment would have to be approved and live in our source.

thanks
Sean

Admin
Admin
7 years ago

Cool, thanks for the update.

Do you mind if I create a new post with that info? (will give you credit of course)

/ Johan

samohtrelhe
samohtrelhe
7 years ago

Hi! Same build but with PE 8.1.. ———————# Run the Imaging tools command prompt as Administrator:C:Windowssystem32cmd.exe /k "C:Program Files (x86)Windows Kits8.1Assessment and Deployment KitDeployment ToolsDandISetEnv.bat " # Run the following commands or save them as a cmd and run it in the Imaging tools command prompt! md c:mountmd C:WinPE_x64 copy "C:Program Files (x86)Windows Kits8.1Assessment and Deployment KitWindows Preinstallation Environmentamd64en-uswinpe.wim" c:WinPE_x64 Imagex /mountrw C:WinPE_x64winpe.wim 1 C:Mount cd /d "C:Program Files (x86)Windows Kits8.1Assessment and Deployment KitWindows Preinstallation Environmentamd64WinPE_OCs" dism /image:C:Mount /add-package /packagepath:"WinPE-Scripting.cab"dism /image:C:Mount /add-package /packagepath:"en-usWinPE-Scripting_en-us.cab"dism /image:C:Mount /add-package /packagepath:"WinPE-WMI.cab"dism /image:C:Mount /add-package /packagepath:"en-usWinPE-WMI_en-us.cab"dism /image:C:Mount /add-package /packagepath:"WinPE-MDAC.cab"dism /image:C:Mount /add-package /packagepath:"en-usWinPE-MDAC_en-us.cab"dism /image:C:Mount /add-package /packagepath:"WinPE-HTA.cab"dism /image:C:Mount /add-package… Read more »

Admin
Admin
7 years ago

Don't know if it will be added in WinPE 5.0, but there are ways to fix this in WinPE 4.0

social.technet.microsoft.com/Forums/en-US/18aea633-de1d-4935-a748-320abc01746d/enable-8dot3name-in-a-task-sequence-using-winpe-40

/ Johan

zdm0293
zdm0293
7 years ago

I understand that they disabled the 8.3 naming convention in ADK and did not include the fsutil.exe in WinPE 4.0.
this is causing applications that use this naming convention to fail.. Are there any plans to add the fsutil.exe back into PE 4.0 or enable the 8.3 naming convention?

Admin
Admin
8 years ago

I don't now for sure about the SRT package, but I expect Microsoft to continue to only include it in the setup boot.wim, and not in the generally available ADK. Like it is for WinPE 3.0

/ Johan

Admin
Admin
8 years ago

ADK is simply the next version of WAIK. ADK is not required for Windows 8 or Windows Server 2012 deployments, you can still use WAIK, but does include additional features that are useful.

/ Johan

Naveed
Naveed
8 years ago

Hi All,

Does anyone knows if SRT package is available for Winpe 4.0 /ADK? I couldn't found it.
Is the recovery package has been moved or renamed or not present at all?

Admin
Admin
9 years ago

ADK is the next release of WAIK. ADK will be used for both Windows 8 and Windows Server 2012 deployments, and will be released at the same time.

/ Johan

NicholasAdrian
NicholasAdrian
9 years ago

What's the different between WAIK and ADK?

I expect that Microsoft will release a new WAIK for handling Windows Server 8 automated installation. Is that a realistic expectation? 😉 or ADK is the NEW way to go.

Kevin King
Kevin King
9 years ago

Thanks. I executed the procedure again and it works, so I did something wrong the first time. The 32-bit sample didn't run, maybe because WinPE still doesn't support WOW64, but an x64 app .NET app worked fine.

Admin
Admin
9 years ago

Hi Kevin,

I tested to write a small Windows Forms Application in C$ (.NET Framework 4 client profile), and that worked fine in WinPE. I have uploaded my sample to this link if you want to try it in your boot image. https://deploymentresearch.com/DRFiles/DotNetSampleAppWinPE40Demo.zip (Please note it's a x86 app).

If you want me to test your code, please zip the project and upload your code somewhere and post the link.

/ Johan

Kevin King
Kevin King
9 years ago

I followed the (excellent) instructions for configuring WinPE with all the packages indicated. WinPE runs fine and executes Win32 programs, but not a simple ("Hello world") .NET 4.0 GUI app. Did I do something wrong in configuration or is there some kind of limit on the kind of .NET 4.0 support?

Admin
Admin
9 years ago

Wow, I have never tested WinPE 4.0 on Windows Server 2003… I stopped using 2003 as WDS servers almost four years ago…

/ Johan

h3mp
h3mp
9 years ago

I made a x86 version of the above – booting from cd is fine and runs my .net4 apps woohoo – but i tried adding the boot.wim to a WDS server (on a win server 2003 box) – it broke WDS and you could no longer network boot.. had to re-store E:RemoteInstallBoot from last backup to get WDS to run again… – I really want this running from WDS!

Naveed
Naveed
9 years ago

Hi Johan!
Thank you for the infomation sharing, I really need .Net support in WinPE, I will check it out soon 🙂

rpieniaz
rpieniaz
9 years ago

Ehhh Cannot find it in my MSDN subscription either MSDN AA or technet 🙁 I'm so keen to do some testing using powershell in Windows PE. It would open so many new abilities of deploying OS and customizing them 🙂

yarbizzle
yarbizzle
9 years ago

I'm excited about the .Net framework support here. Do you know if this can be used used to deploy Win7? My guess is yes. Also, do you know if the WinPE-NetFx4_en-us.cab file would work on a WAIK 3.0 WinPE setup? Just curious. I don't know if we would start using the ADK if it hasn't been through the ringer fully yet.

Thanks for posting this. I haven't found this information any where else yet.

Admin
Admin
9 years ago

I have asked the setup team at Microsoft but no info yet, sorry.

/ Johan

dot45
dot45
9 years ago

When will this be available for technet subscribers?
Or more widely available for that matter?


>