Customize WinPE With Wallpaper and Custom Startup Script

WinPE is a useful tool for booting a computer and laying down a new operating system. In this post, I’ll show you how to make WinPE a little more useful by automatically running a custom script at startup.
Generate WinPE File Structure
On your Windows 10 machine, make sure the Windows 10 ADK is installed. Then, open the Deployment and Imaging Tools Environment command prompt as an administrator.

Run the following commands to create the WinPE files.
copype amd64 C:\WinPE
Next, mount the WinPE files to a folder so you can copy over your custom script (I’ll show you later on how to make a custom script).
Dism /Mount-Image /ImageFile:"C:\WinPE\media\sources\boot.wim" /index:1 /MountDir:"C:\WinPE\mount"
Customize WinPE
Delete the existing startup script and copy over your custom script.
del C:\WinPE\mount\Windows\System32\StartNet.cmd
copy StartNet.cmd C:\WinPE\mount\Windows\System32\
Creating An Auto-executing Script
First, you need to create a file named StartNet.cmd
. The first line of your script will need to be
winpeinit
This initializes WinPE so you can run other commands. When you are done with your script, you should shutdown or restart the computer.
wpeutil shutdown wpeutil reboot
My script below deploys a Windows 10 image to the computer. Details on this will be in another post.
Add A Custom Background
Building Your Background Image
Space on WinPE is limited because it is loaded into memory. I have found that there seem to be some size limitations on this file. One that seems to work well is 1024 x 768 resolution and around 30K in size. Feel free to use this Photoshop file as a basis.

Replacing The Background Image
For whatever reason, Microsoft doesn’t seem to want you to change their default blue background because they really locked down the permissions on this file. You first need to take ownership of the file and then grant yourself Full Control access before you can even delete it.
Rather than clicking through all those dialogs, I suggest downloading SubInACL.exe so you can change permissions from the command line.
Take ownership of the file and grant Full Control (you can also substitute %COMPUTERNAME%
in place of %USERDOMAIN%
if you are using a local account).
"C:\Program Files (x86)\Windows Resource Kits\Tools\subinacl.exe" /file C:\WinPE\mount\Windows\System32\winpe.jpg /setowner=%USERDOMAIN%\%USERNAME% "
C:\Program Files (x86)\Windows Resource Kits\Tools\subinacl.exe" /file C:\WinPE\mount\Windows\System32\winpe.jpg /grant=%USERDOMAIN%\%USERNAME%=F
Delete the existing background image and replace it with your own
del C:\WinPE\mount\Windows\System32\winpe.jpg
copy winpe.jpg C:\WinPE\mount\Windows\System32\
Save Your Changes To WinPE
Apply your changes (make sure you exit out of the folder in Windows Explorer otherwise the image will fail to unmount)
Dism /Unmount-Image /MountDir:"C:\WinPE\mount" /commit
Make A Bootable WinPE CD With Your Custom Settings
Make a bootable .iso
file from your custom WinPE setup
MakeWinPEMedia /ISO C:\WinPE c:\WinPE\WinPE.iso
You should find your .iso
file in the C:\WinPE
directory

Burn this .iso
to a CD and you can boot up a computer and have it automatically run your script.