Update: There is now an easier way to create Windows PE boot media and add your own rescue tools.
- Pip install Boto3 - Thu, Mar 24 2022
- Install Boto3 (AWS SDK for Python) in Visual Studio Code (VS Code) on Windows - Wed, Feb 23 2022
- Automatically mount an NVMe EBS volume in an EC2 Linux instance using fstab - Mon, Feb 21 2022
In my last post, I explained how you can create a bootable USB drive with Windows PE 3.0. Today, I will show you how to add your own tools to your USB drive and launch them conveniently after you boot Windows PE.
Most descriptions on the web will recommend mounting the wim file with imageX and then copying your tools to the Windows PE installation before creating your boot media. Although this makes sense for a rescue DVD, I wouldn't recommend this procedure for a thumb drive. It is just too cumbersome to create your Windows PE installation from scratch whenever you want to add a new tool.
Windows PE automatically mounts your USB drive. Therefore, you can simply copy all your tools to your thumb drive in a separate folder that is independent from Windows PE. Its advantage is that you can update your tools or add new ones without starting from scratch every time. However, with this procedure, you always have to find the drive letter of your USB stick first, and then navigate to the tool you want to launch on the command prompt. Real Windows geeks want more convenience.
In the following three steps, you will learn how to configure your bootable USB drive with your own rescue tools. Steps 1 and 2 have to be performed only once. Step 3 is for adding new tools to your USB drive and has to be followed every time you add new tools.
1. Install and configure PStart ^
Since Windows PE doesn't have a graphical user interface like Windows, you have to launch your tools from the command prompt, which is much too inconvenient for stressed admins. This is why I have created this simple solution so you can easily launch your tools from a GUI. For this purpose, I will use the free tool PStart which I reviewed a while back.
When the installation wizard of PStart asks you about the setup type, you should choose Portable Setup (see screenshot). Select your USB drive and tell the wizard to copy PStart to the root folder. Next, you can launch PStart from your USB drive with Windows Explorer.
To try this procedure, you can copy the free file manager Q-Dir to your USB drive. I recommend creating a special folder for all of your tools. Then, navigate to the Q-Dir folder and drag Q-Dir's exe file to the PStart window. You should see now a new menu point (see screenshot). You can now exit PStart.
2. Launch PStart automatically when WinPE boots up ^
In the next step, we have to make sure that PStart will automatically launch when you boot up Windows PE. For this, you have to mount the wim file on your USB stick with imageX. ImageX belongs to WAIK, which you already downloaded and installed in our last session. Launch the Deployment Tools Command Prompt from the Windows Start Menu and type:
mkdir c:\img imagex /mountrw F:\sources\boot.wim 1 c:\img
I assume here that your USB drive has the drive letter "F:". Now launch Notepad with admin privileges (right-click and select "Run as administrator") and then open:
The problem is that the drive letter for your USB drive won't always be the same because the number of drives in the computer may vary. The following batch script will automatically find your USB drive and launch PStart:
@echo off for %%p 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 if exist %%p:\PStart\ set w=%%p %w%:\PStart\PStart.exe
Add these lines to startnet.cmd after the wpeinit command (see screenshot). I am assuming here that you copied PStart in a folder named "\PStart" on your USB drive. Please note that PStart stores its configuration in an XML file in the same folder.
Save startnet.cmd and then issue this command to unmount boot.wim:
imagex /unmount /commit c:\img
That's it. You can now boot Windows PE from your USB stick. PStart should be automatically launched and you can then run Q-Dir from PStart's GUI with just a mouse click.
3. Add your own rescue tools ^
If you want to add additional tools, you only have to copy them to the tools folder of your USB drive and add them to PStart by dragging their exe files to its GUI. You can do this on your Windows 7 machine like I described in my example with Q-Dir. Thus, adding a new tool to your rescue stick will only costs you a couple of seconds once your USB drive is bootable. That is, in the future only step 3 is required. No more messing with imageX.
Note that not every portable app works under Windows PE 3.0. Raw Copy and Bart's Stuff Test 5, which I reviewed this week, work fine. If you know of other good tools that work with Windows PE, please post a comment below or send me a note. I have created a new category in the 4sysops list of free administration tools for free Windows PE compatible tools.