Update: There is now an easier way to create Windows PE boot media and add your own rescue tools.
- Poll: How reliable are ChatGPT and Bing Chat? - Tue, May 23 2023
- 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
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:
c:\img\windows\system32\startnet.cmd
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.
Read the latest IT news and community updates!
Join our IT community and read articles without ads!
Do you want to write for 4sysops? We are looking for new authors.
This article was a GREAT find! Brian Checkout this command script I created based on this article.
Just edit startnet.cmd and add this line:
REM Start menu
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\menu.cmd
Then create a directory named utils and add these lines and save it to the root of the utils directory:
ECHO OFF
CLS
:MENU
ECHO.
ECHO ………………………………………..
ECHO ..Please select which image to deploy, or x to EXIT.
ECHO ………………………………………..
ECHO..
ECHO 1 – Secure Erase hard drive
ECHO 2 – Utility Apps Menu
ECHO x – Exit and restart
ECHO..
ECHO..
SET /P M=Type Make a selection then press ENTER:
IF %M%==1 GOTO diskwipe
IF %M%==2 GOTO utils
IF %M%==x GOTO exit
REM Start diskwipe
:diskwipe
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\diskwipe\diskwipe.exe
cls
GOTO mainMenu
REM Launch Utils Menu
:utils
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\utils.cmd
cls
GOTO eof
:mainmenu
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\menu.cmd
cls
GOTO eof
:exit
exit
:eof
[bullet]
Next in the utils directory, create an file named utils.cmd[/bullet]
[bullet]Open this file in Notepad and enter the following then save the file:[/bullet]
[code]ECHO OFF
CLS
:MENU
ECHO.
ECHO ………………………………………..
ECHO ..Please select which image to deploy, or 4 to EXIT.
ECHO ..for any questions please send an email to
ECHO ………………………………………..
ECHO..
ECHO 1 – ImageX for Network Deployment
ECHO 2 – Command Prompt
ECHO 3 – 7zip Archive Utility
ECHO 4 – File Explorer
ECHO 5 – Filezilla File Transfer Utility
ECHO 6 – PuTTY
ECHO 7 – Disk Utility
ECHO 8 – Main Menu
ECHO x – Exit and restart
ECHO..
ECHO..
SET /P M=Type Make a selection then press ENTER:
IF %M%==1 GOTO imageX
IF %M%==2 GOTO cmd
IF %M%==3 GOTO 7zip
IF %M%==4 GOTO FileExplorer
IF %M%==5 GOTO Filezilla
IF %M%==6 GOTO puTTY
IF %M%==7 GOTO DiskUtility
IF %M%==8 GOTO MainMenu
IF %M%==x GOTO exit
REM Start ImageX
:imagex
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\imageX\gimagex.exe
cls
GOTO UtilsMENU
REM Command Prompt Portable
:cmd
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\cmd\commandPromptPortable.exe
GOTO UtilsMENU
:7zip
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\7zip\7-zipPortable.exe
cls
GOTO UtilsMENU
:FILEeXPLORER
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\FILEEXPLORER\Explorer++Portable.exe
cls
GOTO UtilsMENU
:Filezilla
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\Filezilla\filezillaPortable.exe
cls
GOTO UtilsMENU
:puTTY
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\Putty\PuTTYPortable.exe
cls
GOTO UtilsMENU
:DiskUtility
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\diskinfo\CrystalDiskInfoPortable.exe
GOTO UtilsMENU
:mainMenu
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\menu.cmd
goto eof
:utilsMenu
@echo off
for %%p in (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:\utils\ set w=%%p
%w%:\utils\utils.cmd
cls
GOTO eof
:exit
exit
:eof
Then in the utils directory, create sud-directories based on the app names you see above. Next go to portable apps.com and download the corresponding apps and add them to the sub-directories.
For diskwipe, use this URL http://www.diskwipe.org
Norris,
Thank you! I will give it a shot today
Norris,
Thank you again for sharing that. It works perfectly!
Good to hear. Hope you and anyone else enjoy the tools I included 😀
Thanks for the tutorial, I managed to create a customized WinPE with a MAC like toolbar.
http://youtu.be/2269reWRGTM
Dear all,
I see chinese they using a window PE in their USB flash drive, but we can’t see any window PE file in that flash drive, so it is very easy for us to use for copying any file without effect to window PE file. Do you have the way to do this.
Hey. I just started experimenting with this. When it first boots to Flash Drive, it gives an error msg something to the effect of no HDD found, insert HDD or cancel. Then it loads the Pstart file. Any suggestions?
Hi Michael,
Everything works fine for me with the install and configuration of Pstart and Q-Dir. But when i boot from the USB-stick the PStart comes up but, when i try to run Q-Dir from PStart it just gives me the following error code: “F:\Q-Dir\Q-Dir.exe could not be executed” any ideas what the issue may be?
Oskar, I guess something is wrong with the drive letter. Try to launch Q-Dir from the command prompt and see if that works.
When I do this with WIN PE 3.1 amd64 (as majority of my machines are 64 bit) I get the following error code any time I run a .exe including Pstart
“The subsystem needed to support the image type is not present”
I am decently proficient in mounting and adding packages to an image so if you know what to add to the PE I would be able to do it. I am able to get GimageX to work as long as it is in the system32 folder of the image.
I have created launcher startPstart.exe and use it in wpeshl.ini, see previous comment 74:
[LaunchApps]
%windir%\system32\netstart.exe,-prompt
%windir%\system32\startPstart.exe
I use PowerBasic Console Compiler, code is VERY simple:
‘—————————————————–
#CONSOLE OFF
#COMPILE EXE
#DIM ALL
FUNCTION PBMAIN () AS LONG
LOCAL strApp, strDir, strPath AS STRING
LOCAL cDrive AS STRING * 1
LOCAL i AS INTEGER
strApp = “PStart.exe”
strDir = “PStart”
strPath = “:\” + strDir + “\”
FOR i = ASC(“A”) TO ASC (“Z”)
IF ISFOLDER(CHR$(i) + strPath) THEN
SHELL (CHR$(i) + strPath + strApp)
EXIT FOR
END IF
NEXT i
END FUNCTION
‘—————————————————–
You can download it from my web:
http://itlog.cz/dwn/startPstart.zip
Enjoy!
I know this is a very old “stream”, but it is very useful for what I need to do. I have successfully built the usb and pStart starts like it is supposed to…. however, instead of my few tools, there is a long list of tools (some of which aren’t active). Is there a way to limit the list to my tool set – or did I screw up the install?
Also, is there a way to remove icons that are currently on the desktop? Thanks for the great write-up and any assistance you can provide.
Sorry to bother you on such an old post but im stuck on step 2, i type the command into my prompt and keep getting error “the system cannot find the file specified.” i have noticed that i do not have a program named imagex but i do have one called windows system image manager. Using windows 8 if it matters.
Chirs, if you are using Windows 8, you need the Windows ADK. It contains the imagex tool.
I keep getting an error: The subsystem needed to support the image type is not present.
Sorry to activate an old thread. This is amazing guide. I just one.. rather dumb question that’s confounding me. Once I get everything loaded on my test machine.. How do I get my adds like tdsskiller etc to scan the PCs primary partition? It keeps scanning the X partition.
Thanks
I am here to get to the bottom of what is wrong with the script for startnet.cmd I took the hidden space out, made sure there was a folder named PStart with the proper PStart files inside. I rewrote the script ten ways from sunday and still it doesn’t auto start PStart.exe please update the tutorial thanks.
Dustin, thanks for the hint. I have a new plugin for code and it seems it messed some of the code in the article. I hope it is okay now. And you are right, the folder PStart has to exist.
This is an excellent tutorial! Thank you, sir!
Check out this post for an easier way to create Windows PE boot media with rescue tools.
Hi, Michael! After implementation of the instruction of startnet.cmd the message is issued: wpeinit isn’t internal or external team… What to do? Thanks.
Michael, sometimes pstart loses the xml config and i have to readd all my programs sometimes. Know any resolution to preventing this?
Tom, I never had this problem, but I don’t use Windows PE anymore for this purpose. Did you consider working with Windows To Go instead?