While not officially supported, PowerShell 7 seems to play well with WinPE. Here is a short script that adds PowerShell 7.4 to WinPE 11. In this update, I tested adding PowerShell 7.4.13 to Windows ADK for Windows 11 24H2 (Build 26100).
Update January 4, 2026: Verified support for PowerShell 7.4 and moved the script to GitHub.
Note: While PowerShell 7.4 is not the latest stable release, it's currently the latest Long-Term Support (LTS) release, built on .NET 8, which I recommend for WinPE. The upcoming 7.6 version will be the next LTS release, built on .NET 10. LTS releases are supported for three years.

Download PowerShell 7
First, download the ZIP version of the latest PowerShell 7.4, at the time of writing this blog post it was 7.4.13: https://github.com/PowerShell/PowerShell/releases. For this example, I downloaded PowerShell-7.2.5-win-x64.zip and saved it in my C:\Setup folder.
Adding PowerShell 7 to WinPE using PowerShell
Here is the script that adds PowerShell 7 (and some other components to WinPE) as well as sets the environment variables for it: https://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/WinPE/Add-PowerShell7.ps1
Newer versions of Powershell 7 require additional files (ICU*.dll).
You might want to update your script.
Hi Eric,
Thanks for the heads up. I have tested the script against the latest Long-Term Support (LTS) release of PowerShell 7, which is currently 7.4.13. Are you referring to the latest stable release (7.5), or any of the 7.6 preview releases? For OS Deployment solutions, you probably want to stick to the LTS releases since they are supported for 3 years.
I'm referring to Powershell v7.5.x
In my own testing, I've noticed that to make Powershell 7.5.x work in WinPE11, you need to add the following files from a Win11 OS to the WIM file:
\Windows\System32\icu.dll
\Windows\System32\icuin.dll
\Windows\System32\icuuc.dll
\Windows\Globalization\ICU\*.*
# This prevents the error "Could not load ICU data. UErrorCode: 2"
I also tested with 7.5.4 and didn't see any issues. Which cmdlets break because of the missing files? (This was on Windows ADK 24H2)
When do you see this error? When loading PowerShell 7, or when running a specific cmdlet/function?
Observed with PowerShell 7.4.5 and Windows PE from the may 2024 Windows ADK (10.1.26000.1). I ran into an issue with "Get-PhysicalDisk" cmdlet in PowerShell 7.4.5 under WinPE. It fails under PowerShell 7.4.5, but works under Windows PowerShell 5.1. As far as I can see, there are two versions of the CimCmdlets modules: version 1.0.0.0 in "%windir%\System32\WindowsPowerShell\v1.0\Modules", that works under Windows PE. version 7.0.0.0 in "%ProgramFiles%\PowerShell\7\Modules" that will not work under WinPE. If you run "Get-Module -ListAvailable -All" under the PowerShell 7, you will see that the 1.0.0.0 version of CimCmdlets is marked for PSEdition Desk, and that the 7.0.0.0 module… Read more »
Since PowerShell 7 is not tested for WinPE, your milage might vary
Hi Johan,
Can you use the Get-ComputerInfo command in powershell?
Yes, that cmdlet works in both Windows PowerShell and PowerShell 7 in WinPE.
This script works with arm64 architecture as well. I tested with the May 2024 ADK and WinPE.
However, to get a bootable ISO, you need to copy the AMD64 version of etfsboot.com from "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\etfsboot.com" to the same directory for arm64.
It is probably also a good idea to include the optional components WinPE-x64-Support.cab and WinPE-x64-Support_en-us.cab as well.
Thanks for the info!
Hi, thanks for this script which run without any error.
But once I modified my winpe (I extracted boot.wim from the created ISO, and put it in the windows PE kit, to be used by MDT), I can't create a capture image from boot image with powershell 7. When trying with old boot image, no problem.
Error is : The Windows Deployment Service Image Capture Wizard was not found in the specified Windows PE Image
Thanks
I haven't tried, but it's probably the WinPE-WDS-Tools optional component from ADK that is missing.
Thanks for all of your scripts. I upgraded my way to do capture, by fully using MDT now. And no problems at all.
$devDetail = (Get-CimInstance -CimSession $session -Namespace root/cimv2/mdm/dmmap -Class MDM_DevDetail_Ext01 -Filter "InstanceID='Ext' AND ParentID='./DevDetail'")
..to get HardwareHashes, does not work..
It's not supported to gather hardware hashes in WinPE. Only in full Windows.
How do i use this script?
It wont run as an ps1 or as a cmd file?
it spits out errors on your Variables in the script.
I have used the guide from Microsoft for the Powershell 1.0, so that part works, but i would like to have 7 now, and get rid of the notice for Updates.
The Microsoft-way works.
https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-adding-powershell-support-to-windows-pe?view=windows-11
This is just a regular PowerShell script. Run it from PowerShell, or PowerShell ISE, or VS Code.
I tried it and it works. But too bad it's working only if original powershell is integrated.
Hi Dan,
What commands didn't work without the original PowerShell?
Get-Disk, Clear-Disk, New-Partition, Get-Partition. Also, Get-Counter (unable to load pdh.dll or one of its dependencies). Probably there are more. But I think I know why. If I don't integrate powershell 5.0, the environment variable path is missing the path to c:Windows\System32\WindowsPowerShell\v1.0.
Hi Dan,
Thanks for the info.
Missing WinPE-Scripting.cab, WinPE-Scripting_en-us.cab, WinPE-StorageWMI.cab and WinPE-StorageWMI_en-us.cab to make disk commands work