Home Miscellaneous WinPE Media Builder – Powershell <3

WinPE Media Builder – Powershell <3

Reading Time: 3 minutes

In this blog post, I’m sharing a PowerShell script, Which I think some will find useful. This script is based on a script i found by “Gregory Strike” but has been updated and modified, but the core WinPE functionality I’ve taken from his blog post you can find here. Some might ask why created the script? There was a time and a place where for a couple of months I was constantly needing WinPE Images for various deployment options, diagnostics and testing and I was sending hours having to manually copy and paste the command and use the janky MakeWinPEMEdia. So I decided as many of us have done, to spend hours and hours developing a solution to save all of 5 minutes of copy and pasting.

So what does the script do? It requires you to have the Windows 10 ADK & WinPE Add-on Module installed. If you dont already have these download you can acquire the setup packages from the Windows 10 ADK Site. [Download Here]
[NOTE: At time of posting Windows 10 2004 ADK was the latest release]

Windows Assessment and Deployment Kit Setup

Once we have downloaded the adksetup.exe and adkwinpesetup.exe. First let’s install the ADK Files, For the WinPE Script to work all we require is the Deployment Files (91.4Mb). You may wish to install more of the ADK, but this is all that’s required for the script to work.

Next lets install the WinPE Add-on this in a single installer around 5Gb.

Once you have the WinPE Media installed, you can download the initial setup script from the HypervLAB GitHub Repository [GitHub Link]

Initial Environment Setup

    WinPE Media Builder Setup Script

    WinPE Default Root Setup Script 

    Simon Lee
    #HypervLAB - https://hypervlab.co.uk

    13.11.2020 - Inital Script Created


# Define Setup Directory
$SetupDir = Read-Host -Prompt 'Please Enter Setup Directory Drive Letter (Example: C:\)'
$Folder = 'WinPEBuilder'
New-Item -ItemType 'Directory' -Path $("$SetupDir\$Folder")

# Folder Structure
New-Item -ItemType 'Directory' -Path $("$SetupDir\$Folder\Notes")
New-Item -ItemType 'Directory' -Path $("$SetupDir\$Folder\WinPE_Applications")
New-Item -ItemType 'Directory' -Path $("$SetupDir\$Folder\WinPE_Backgrounds")
New-Item -ItemType 'Directory' -Path $("$SetupDir\$Folder\WinPE_Drivers")
New-Item -ItemType 'Directory' -Path $("$SetupDir\$Folder\WinPE_ISO")
New-Item -ItemType 'Directory' -Path $("$SetupDir\$Folder\WinPE_Patches")
New-Item -ItemType 'Directory' -Path $("$SetupDir\$Folder\WinPE_Unattend")

# Download Configure-WinPEImage Script
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/hypervlab/hypervlab-resources/master/winpe/Configure-WinPEImage.ps1" -OutFile $("$SetupDir\$Folder\Configure-WinPEImage.ps1")

Launching WinPE Builder

By Default on a new Windows 10 Built the ability to run Scripts is Blocked. As shown in the Sample below.

I Would recommend changing the Execution Policy to RemoteSigned

Set-ExecutionPolicy -ExecutionPolicy 'RemoteSigned'

Now we can launch the script.


GIF Sample of a WinPE 64x Build


Please enter your comment!
Please enter your name here