143 - Modify any WinPE OS without changing the source files using PEStartup
Introduction
Scenario:
You would like to boot to WinPE and add your own Desktop shortcuts to some of the portable apps on your USB drive, change the WinPE's wallpaper, add Registry entries and auto-run a few programs.
You have a multiboot USB drive (e.g. Easy2Boot or some other bootable USB drive).
You have a number of WinPE ISOs, WIM files or other type of WinPE payload on it.
You do not want to have to rebuild the WinPE ISO\WIM file each time.
This solution allows you to do just that.and it will work for all your WinPE's that have Explorer included in the build (e.g. WinBuilder WinPEs).
Drivers: automatically install drivers every time booting into WinPE.
Drivers can be downloaded from DriverPacks.
If you want to use your driver, compress it to a .zip file or use an ISO file.
For XP, you need to rename the file and add “XP_” before the file name.
Shortcuts: add shortcut to desktop screen on startup. This gives you quick access to the files.
AutoRun: automatically runs programs or scripts every time the system boots.
Registry: automatically import Registry files every time you boot into WinPE.
Options: set wallpaper and RAM Disk memory size, enable/disable what is run on startup.
Shortcuts and Autoruns should be either on the X: drive or the same volume containing PEStartup.
Usage:
The solution will automatically run after 20 seconds, provided ChrisR's Win10PESE WinBuilder Project at TheOven.org was used to make the WinPE OS and if it includes the default 'Portable Finder Startup' plugin.
You can check to see if your WinPE is compatible by looking for the file X:\windows\system32\Portable Finder Startup.cmd once booted to WinPE.
The plugin can be found in WinBuilder WinPESE projects at \Apps\System Tools\'Portable Finder Startup'.
Some Gandalf WinPEs based on WinBuilder Win10PESE (e.g. Gandalf Redstone 2) will automatically work.
For all other WinPE's which do not have the WinBuilder 'Portable Finder Startup' plugin, once you have booted to the WinPE Desktop, you must manually run the \TheOven_Startup.cmd script by double-clicking on it.
Note: Unlike most Portable App launchers (PortableApps, LuPo, LiberKey, GeGeek Toolkit, etc.), PEStartup can run 32-bit apps and 64-bit apps and does not require a 64-bit WinPE to have WoW64 included in it's build.
How it works
In either case described above, the script \TheOven_Startup.cmd is executed under WinPE.
This script runs the PEStartup .exe file located under \AIO\Tools\PEStartup on the USB drive.
PEStartup is a convenient Windows GUI utility with which you can easily add Desktop shortcuts to any portable apps that you have on the USB drive.
It can also be configured to change the Desktop Wallpaper, add Registry entries (from .reg files), install drivers and autorun programs.
PEStartup stores it's configurations settings on the USB drive in the same \AIO\Tools\PEStartup folder.
To change the configuration, just boot to WinPE and edit them using the PEStartup GUI.
Background
Tứ Nguyễn is the author of AIOBoot, a multiboot USB solution. He also wrote the PEStartup executable which is detailed here.
I have written a small \TheOven_Startup.cmd script which will automatically start the PEStartup executable (or which you can run manually if the WinPE OS does not have the required plugin).
This tutorial is using his PEStartup tool.
How to add PEStartup to your bootable USB drive
1. Download the .zip file (see bottom of page) and extract it to the root of your USB drive.
OR - for a version with PortableApps already added, download the PEStartup_Papps version.
Gandalf PE with PEStartup_Papps and default wallpaper (click to enlarge)
You should have the following files/folders now present:
\TheOven_Startup.cmd (do NOT change the filename or it won't be automatically found by WinPE)
\AIO folder
2. If you are not using the PortableApps version, you can add any portable apps that you want to the \AIO\Tools folder - each in a separate folder.
7Zip, imdisk and BootIce v1.3.4 are already included.
If you already have portable apps in a different folder, you can leave them there. They just need to be somewhere on the USB drive.
For instance, you can add PortableApps, PortableAppZ, WinNTSetup, PStart, Cent Browser, Cent Browser XP, Teamviewer 6, Opera 12.
If you have the PortableApps version of the download, you can add 32-bit portable apps by clicking on the Apps icon (best done under a full Windows OS)..
3. Add any driverpacks you want to the \AIO\Tools\Drivers folder.
Drivers can be downloaded from DriverPacks.
XP driver .zip files must begin with a name of XP_
4. Add any .reg fragments that you want to the \AIO\Tools\Registry folder
Bob Omb's WinPE
If you have made a .imgPTN file from a Bob Omb's WinPE ISO, some version automatically run TheOven_Startup.cmd from the USB drive (if it is present).
If it does not automatically run TheOven_Startup.cmd to start PEStartup, then you can add this line to the \Auto.cmd file that should already be present on the E2B drive once it has been 'switched' to the Bob Omb's .imgPTN file:
FOR %%D IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO call %%D:\TheOven_Startup.cmd > nul 2>&1
PortableApps
Note: Start.exe (PortableApps launcher) is 32-bit only as are the portable applications themselves - so either a 32-bit WinPE is required or a 64-bit WinPE+WoW64 to run 32-bit apps. See blog post here for alternative launchers.
Instead of using separate applications, I install PortableApps.com to \AIO\Tools folder.
This creates a \AIO\Tools\PortableApps folder and you can run Start.exe and quickly download any Portable Apps into this folder using the Apps menu tab in the GUI (under a full Windows OS).
I then configure PEStartup to run \AIO\Tools\Start.exe on startup.
You can move the BOOTICE folder (or any other portable app you want) to under \AIO\Tools\PortableApps and it will then be included in the PortableApps menu automatically when it is next launched.
The GUI also has it's own Shutdown\Restart button which can be used if the Start menu Shutdown/Restart button does not work (e.g. some Gandalf WinPEs).
If you wish, you can also create Desktop shortcuts using PEStartup to any of these apps including Start.exe.
Run Start.exe under Windows if you want to add more PortableApps if you have problems adding apps under WinPE.
How to use PEStartup
1. Boot to your chosen WinPE OS.
If you want some WinPE .wim files which you can just add to an Easy2Boot USB drive, try the AIOBoot XP or the Win10 WinPEs from here and the Gandalf WinPEs. These will automatically run PEStartup.
You can make your own WinBuilder Win10PEs using ChrisR's WinBuilder project here.
Other WinPEs include those by Falcon F4, Strelec, Hiren, DLC, Dium, etc.
2. If PEStartup does not automatically start after 30 seconds, double-click on \TheOven_Startup.cmd
A PEStartup shortcut will be added to your Desktop + any other configuration changes that you have specified.
3. You can now use PEStartup to add Desktop shortcuts, autorun programs, specify a wallpaper file and run registry fragments.
Note that PEStartup will keep 64-bit and 32-bit configurations separate.
If you run PEStartup_x86.exe you can configure the 32-bit configuration.
If you run PEStartup_x64.exe you can configure the 64-bit configuration.
You can run both of these under a full Windows 64-bit OS to set the configuration options (but do not run the Options - Perform button or it will change your Windows Desktop!)
After Saving any changes, you can make them take affect immediately by clicking the 'Perform' button (only do this under WinPE, not a full Windows OS).
For instance, you can add a shortcut on a 64-bit WinPE Desktop for \AIO\Tools\7Zip-64\7zFM.exe.
If you want to autorun a .bat or .cmd file and see the cmd shell, you may need to precede the 'Path to file' value with START - e.g. START D:\TEST.BAT
If adding to an Easy2Boot USB drive, you can also add shortcuts to hack Windows accounts using UtilMan.
Changing how PEStartup runs
The \TheOven_Starup.cmd script contains the parameters to automatically run PEStartup and then quit.
The file contains these lines:
REM run PEStartup
REM remove --hide if you don't want the app to close,
REM remove --perform if you don't want the configuration to take affect
start %USBDRIVE%\AIO\Tools\PEStartup\%XE% --perform --hide
You will need to change the parameters in red to change it's behaviour.
Drivers
As well as specifying drivers in the configuration, you can automatically load drivers with PEStartup v1.1.6 (PEStartup_v3)
v1.1.6 (08.10.2017):
- Automatically install the driver included in the "\Drivers, \Drivers_x64, \Drivers_x86 and \Drivers_XP" folder in the root of your USB.
You need to extract the files to this folder.
- \Drivers: loads ALL.drivers
- \Drivers_x64: for WinPE 64-bit.
- \Drivers_x86: for WinPE 32-bit.
- \Drivers_XP: for WinPE XP.
Double Driver is a good program for backing up your drivers.
If the driver package is packaged in ISO format, the program will mount the ISO file instead of extracting the file.
This will save time and disk space (for extraction).
Easy2Boot and UEFI-booting
To boot UEFI payloads from an Easy2Boot USB drive, we can use .imgPTN23 partition image files instead of ISO files.
When you 'switch' to the new partition image file, the contents of the E2B partition (an PEStartup) are no longer accessible.
If you have a WinPE .imgPTN file, one solution is to create a second partition which contains the PEStartup files, as follows:
If you have a 'fixed-disk' type of E2B USB drive (e.g. USB HDD or SSD):
You can do this on large Removable-type USB flash drives, but it will only work with recent (1607+) versions of Windows 10 and WinPE 10.
The first two steps are only required if using E2B v1. E2B v2 already prepares a 2nd FAT32 partition.
1. Remove the small type 21 hex 2nd partition (usually about 30K) on the E2B USB drive (if present)
2. Shrink the first partition and create a new 2nd Primary FAT32 partitiion on the E2B USB drive (the size needs to be large enough to hold all your portable apps) - you can use EaseUS Home Partition Master or another disk management application for this. If you have a 3rd NTFS partition, you can extract the files to there instead.
3. Extract the files from the PEStartup download onto the root of the 2nd FAT32 partition (or 3rd NTFS partition).
4. Rename the file extension of any Windows or WinPE .imgPTN files on the E2B USB drive to have a .imgPTN23 file extension
When you 'switch' to the image file, the 2nd partition and 3rd partitions will remain and will be available to the booted OS.
.imgPTN23 files should be made using the MPI Tool Kit and the MPI_FAT32 Desktop shortcut.