POLL: POWERSHELL VS. GUI - DO YOU WANT TO BE A DEVOP OR AN ADMIN?
Create a bootable Windows PE 3.0 USB drive with rescue tools – Part 2
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.

By
Thanx for this part2, I will try this weekend !
Great. Please let me know if it worked.
You should definitely have a look at RocketDock. It’s just as simple to configure but unlike PStart it looks really good as well.
http://rocketdock.com/
Thanks for the tip Mikael! It is on my to-do list. Does it also run on Windows PE?
Hi Michael,
Rocketdock runs just fine on WinPE, I’ve been using it for about a year with no problems.
I does however use a lot of sceenspace width-wise. I use a utility called “setres” to increase the resolution of the screen. I does not support wide screen monitors however, probably because there were no such around back in 2005…
Does anybody know of a better app???
Setres is freeware and can be downloaded from http://www.softpedia.com/get/Multimedia/Video/Other-VIDEO-Tools/SetRes.shtml
Don’t know if it’s what your looking for, or will work in WinPe but the old app “Size-o-matic” is standalone and supports custom windows sizes. If I just could get my WinPE usb to boot so I can try it… Something is going wrong with my usb drive?
Mikael, perhaps adding your video card driver to WinPE will help?
Pettson, what exactly doesn’t work? Did you check if USB boot is enabled in your BIOS? You also have to make sure that the USB drive is configured as the first boot drive in the BIOS.
WinPe is booting, then wpeinit command starting. After that I got “‘e’is not recognized as an internal or external command, operable program or batch file”.
I have follow the steps you wrote, twice on 2 diffrent pc’s, 2 usb drives and 2 WAIK installs. Only diffference is on first usb drive it says ‘x’ and second ‘e’? It must be device letters, e and x but for/from what?
This sounds as if something went wrong when you copied the batch script. Please make sure that you only added two lines to startnet.cmd. The first one ends with “set w=%%p” and the second starts with “w=%%p”. It is also possible that you are using a different folder name for PStart. There has to be a folder in the root directory of your USB drive named “PStart”, otherwise the batch script can’t find the location of PStart. You also have to ensure that there are no other drives with such a folder in the root directory.
Got it! Found hiden spaces in your startnet.cmd lines Michael. Did a imagex re-mount on both usb drives and wrote the startnet.cmd lines by hand and now it works.
Now it’s time to see what tools that could be used, first to try is Foxit Reader, Express burn and Recuva.
Congrats! A good place to start looking for WinPE tools is here. Let me know if you found new tools that work on WinPE 3.0.
http://www.snapfiles.com/features/ed_usb_software.html and http://www.pendriveapps.com have a nice list too
A starter and here to.
InfraRecorder
WinRAR unplugged (shareware)
TreeSize (Copy installation folder)
Defraggler
Disk to VHD (SysInternals)
Recuva (Skip the wizard)
All above are working for me.
HWiNFO32, SiW and CDBurnerXP are some of the software I did try and fail with, but i have read that they “should” work as standalone.
It will take some time to fill a 2GB stick with working and useful software that will come in handy both at work and private.
oh, my links did’nt worked out as ment..:|
Pettson, thanks a lot! This is interesting information! I corrected the links.
https://www.sit.auckland.ac.nz/Create_a_custom_boot_image
I really like this shell, it’s basic but does the job and looks familiar.
http://explorerplusplus.com/
I had the same issue with the blank spaces. Thanks Pettson, you probably saved me some valuable time from searching back through everything I did.
Hi Michael,
This tutorial was excellent, and it allowed us to make a really nice bootable USB utility flash drive.
Some computers here can’t boot from USB, and I was wondering if you knew of a way to do the same thing using a CD/DVD?
I suspect you are a busy guy bombarded with e-mails all day long. If you’d be so kind as to assist us, I’d be happy to send you a Lehigh University shirt or something else from our spirit shop. Just let me know your size.
Thanks,
Steve
Thanks Steve. The problem with the DVD solution is that you have to build a new Windows installation every time you want to add a new tool. If you really still need DVDs, I recommend using UBCD. There are also two new projects that are based on Windows PE 3.0. And thanks for the shirt, but I am a digital nomad and my bag is already full.
I did the last part of your intsructions but when I boot from the flash I get a error message.
‘f’ is not recognized as an internal or external command, operable program or batch file.
Can you tell me what I did wrong Thanks.
Hi Michael:
I need some help here. When I try imagex /mountrw F:\sources\boot.wim 1 c:\img i get the following error
error mounting image
A required privilege is not held by the client.
I ran the depoly tool camand promt as Admin but still get that error
Brian, maybe no write privileges on the folder? What happens if you mount the image for read? You could also try a different folder.
Greetings Michael,
Like steve on June 14 I attempted to use your script on a cd version of 7 PE and get the same error ‘e’ not recognised etc.
I created my PE from win 7 ultimate (fully updated) using win 7 AIK
I have made the alterations as administrator to startnet.cmd three times always the same result.
I used Ultra ISO to add the Tools and PStart folders to the root of the CD, easier than imagex!!
Any help you could give would be wondeful.
David Tonks
Hi Michael,
I was following your steps by steps.
Everything is doing well.
Only Q Dir isn’t working.
OS I’m using is windows 7 Home Prem 64bits
I’ve try to download all the version of Q Dir but none of them would start up and prom me an error message.
Appreciate if you could help me solve my this small little problem
Thanks alot
Hello Michael
Thanks a lot for your short and easy description.
I am writing because I get an error with the script you use for finding the USB drive letter. It has problems with checking my floppy disc drive without a floppy in it.
I have written my own workaround and want to give it to you.
The drive letter of the USB disc you are booting from is written in the registry under HKLM\SYSTEM\CurrentControlSet\Control with the name PEBootRamdiskSourceDrive. I use this information for starting the PStart.exe. Here is my script (all in one line):
for /f “eol=! tokens=3″ %%d in (‘reg query hklm\system\currentcontrolset\control /v PEBootRamdiskSourceDrive’) do %%dPStart.exe
Greetings from Germany
Ralf
I have this all setup and have created several ghost images that I am applying. What I would like to be able to do is somehow play a sound when the ghost images has been applied. What do I need to enable to get sound working (sound card or pc speaker)??
Thanks
thanks a lot, first time I got it to PE 3 to work
but, something I am missing, a NETWORK
how can I get connected to the network?
Thanks
Fidel
If Windows PE has a driver for your NIC, it should work right after the installation. Try ping to see if you are connected.
Jeap, perfect, I got it to work, I want to use some kind of network analysis in it
Again, Lot of thanks
Cheers
Fidel
Thanks for the info. WinPE works fine w/ Q-Dir. I was able to connect to a network drive but couldn’t map it to a letter. Any ideas?
I’m building a PE using nu2menu instead of the suggested menu system. It’s in the process of committing at the moment, and I’m probably not going to post again here for a bit, so I was wondering if anyone else had tried…
If RocketDock is working, I have virtually no doubt that this will, but I am curious…
Hello and thank you for sharing your knowledge. I ran into a stop right here > “Now launch Notepad with admin privileges (right-click and select “Run as administrator”) and then open.” I’m stuck right here at the note pad deal. In my head it doesn’t really say what to do. Copy the stuff below this line into note pad? “Add these lines to startnet.cmd after the wpeinit command.” I don’t have any thing called wpeinit. Where did it come from and where is it at? It just seems to show up after it tells you to open note pad. Then near the end it says this? “Save startnet.cmd and then issue this command” So, are we back at deployment tool command prompt? I did get my usb drive to boot ok, I thought I was really styling until I got to the notepad thing. FYI: I don’t know squat about batch files. Maybe I’m trying too hard. I’m just not getting it. I would be thankful for any suggestions.
Thanks, Bill
GOD Bless America
Hello,
I’ve made some headway. All seem to go as it should, but when I boot it up it leaves me at a command window with this: (x:\windows\system32>wpeint) then it rolls one more line to this: (x:\windows\system32>wpeint) Where am I going wrong? Anyone?
Also, part two post nine it is says: “Please make sure that you only added two lines to startnet.cmd. The first one ends with “set w=%%p” and the second starts with “w=%%p”. It is also possible that you are using a different folder name for PStart. There has to be a folder in the root directory of your USB drive named “PStart”,” Does this mean ditch the echo part?
Thanks, Bill
God Bless America
Bill, do you still don’t see the wpeinit command? If so, then you are in the wrong file.
Hello,
Thanks for the reply. I thought I had figured it out, but no joy. I did post again, but my post seems to have vanished. My last post basically said that all seems to go as planned, but it just won’t work. I am newbie tech learning as I go. I love the tool and think I would use it a lot. It may even make my IT brother-in-law say wholly crap, that’s awesome! I’m really hoping I can figure it out. Here is where I’m at now. It looks like it’s going to boot to a desktop type GUI screen and then a command prompt window pops up and leaves me here. (x:windows\system32>wpeint) Then it scrolls one more line that says. (x:windows\system32>) and that’s where things come to a halt. Is this the point where it would launch the Q-Dir program which is responsible for the GUI interface? That’s where I’m at now. Obviously I’m missing some detail, but I am failing to figure out what it is. Oh, and by the way I love the forums. So very much to gain from them. My apologies for being such a pain. Thank you for your time and effort.
Bill
God Bless America
Hello again,
Sorry to be Mr. posts a lot. I can now boot to my USB drive and at the command prompt that pops up I can run the Pstart.exe and get to my added programs and run them. So at this point, I would say there is something I’m doing wrong with the auto run setup. I have been doing a copy past for the notepad entry’s as I’m not that comfortable at the command line. So then my question would be. Is or can you check to make sure that what is posted is correct? If it is, does anyone have any suggestions? Thank you.
Bill
God Bless America
Bill, I think the description is correct. Can you copy and paste the contents of your startnet.cmd here? Did you get an error message when you unmounted the image?
This article & info is very good. The only problem I have had with it is that PStart does not appear to support x64. It wont start in a x64 WINPE enviroment. It fails with the error “The subsystem needed to support the image type is not present”
This is also the same for rocketdock but at least it mentions it on the rocketdock website!!! So waste your time trying!!!
If anyone know a good alternative???
Awesome posting/tutorial. Very useful in making that trusty WinPE boot disk even better!
Hello
First sorry for my english
Like Mikeal, my winpe does not support wide screen monitors (1680×1050). The driver is correctly installed but tools like setres can’t use this definition. Definition as 1920×1200 work well but not 1680×1050.
Any ideas ?
Hi,
I like your tutorial, and I have created a bootable
windows pe 3.0 usb drive, and added many tools to
it. But for Nir-Launcher and also for Sysinternals
Suite I would need an internet connection to do
updates. But how can I get a connection via the
Laptop I boot the Stick and LAN or WLAN?
Is there a way, and how?
Or is it possible to integrate XPE from the BartPE?
I tried to start it without installation, but it gives
me the answer, it should never been started in a real
windows.
Kind regards, Walter.
Thanks! Works on a Dell Optiplex 745 but on a 760 and 780 the usb harddrive does not show up.
I put pstart and q-dir in the program files in c:\img so I could start it from x:
The WD My Passport se 1T does not show up.
What could be the difference between the computers that it would work fine on the older one but not the new Dells?
You are the man!!!
I had forgotten my windows password and tried some tools like Ophcrack and PC Login Now but could not get them to work…
I have now created a bootable USB stick with Windows PE, Pstart (Which starts automatically)and NTPWEdit.
That worked like a charm, when I got it all right on my USB stick.
What can I else use this USB stick for…?
Has anyone figured out yet how to hide the DOS window?
Michael, nice post, I am Citrix admin, try to get usb jump drive to work on XenDesktop 5. Do u know how to integrate XenApp OnlinePluginWeb v12.1.0.30, if so appreciate to let me know.
Another question, if I put PStart.exe on root (not under folder), should I also change for %%p line?
Thanks
Works great. make sure to follow directions to the point. I didnt have PStart in its own folder and it wouldn’t boot. Then I had the folder as “Pstart” and that didnt work, it needs to be “PStart”
You definitely need GIMagex.
A GUI for imagex.
The best part about it is, when you boot a computer with multiple drive letters, it takes the guess work out of finding the correct source and destination for images.
http://www.autoitscript.com/site/autoit-tools/gimagex/
Is there a way to integrate the Explorer file manager into winpe3? Can’t seem to get it to run.
Corey, I don’t think this will work. You can use Q-Dir on WinPE.
Michael, this is awesome!
Thank you very much, everything worked perfect, even though I followed the instructions blindly without really understanding what I am doing. You made it really clear.
Now I have my pen-drive with the tools, which I have been using for a while. BUT..I have a computer with an AMD RAID that I need to access..and W7 does not have the driver by deafault.
Do you know how I could do to add the Raid driver to the WPE pen drive I created following your instructions?
(the driver is 3 files, a .info a .sys and a .cat
Thank you very much!
Gonzalo from Argentina
Well, I solved my problem, instead of using the pendrive with WPE, I used the W7 installation DVD and selected Repair, and opened a command promt (which in the end I believe it’s the same thing, a WPE).
But before opening the command prompt the installation DVD gives you the option to add drivers to its WPE virtual disk.
So I could do what I needed.
I still would love to know (if it is not very complex to explain) how to add drivers to your pen-drive.
Thanks!
Gonza
I found it. You can load drivers with the Drvload command.
Also you can enable TCP/IP (internet access) with Netcfg -v – winpe.
thanks,
gonzalo
Hi,
I have problem starting the script for selecting the flash drive.The usb boots and shows the cmd-startnet.cmd but when it should find the drive, there is nothing happening.In the posts there is a thing that i can’t figure out.Above, you have the script shown and in post 9 you tell us that the line has to be in two parts, ending and beginning with “w=%%p”.This is very confusing. If this is the right way, why don’t you change the code?
When i do this in two lines, the second one is not executed.When i put w=%%p in front of the second line i having error “w is not recognised”.
I don’t get it.It looks a nice tool to me and i can sure us it to make images.To see what the usb drive was doing, i disabled echo and i can see the lines where he looks for the right drive but PStart is not booting at all.PStart is at \PStart\PStart.exe
Can you help me out here
Bruno, could it be that you forgot the set command? “w=%%p” doesn’t work. You need “set w=%%p”.
Hi Michael,
Do you mean the “set” in the script above?
Yes, i made a copy and pasted it in my noteblock.
In noteblock, it looks exactly the same as in the example above.
But when i run the script, my computer tells me that G is not recognized as an internal or external command, program of batch file.G is the drivename of my usb drive.
It looks like the script can’t work with
” %w%:\PStart\PStart.exe” line to start the program.
Thank you for the nice article. Saved me a lot of my spare time.
It was great following this article and I was able to create my bootable WinPE USB drive inclusive of my tools; Ghost11, NTPWEdit, Q-Dir and Raw Copy. I have tried PStart but I preferred RK Launcher for my menu which is like RocketDock.
http://home.cogeco.ca/~rklauncher/
- Donwload and extract.
- Copy on your mounted image. (preferably on %systemroot%\RKlauncher)
- Copy your Tools/Programs (preferably on %systemroot%\Tools)
- Copy msi.dll from your PC to System32 of your mounted image
- Launch RKlauncher with admin rights and modify your your dock properties. (Point to your tools/programs)
- Edit startnet.cmd and add this line
%systemroot%\RKlauncher\rklauncher.exe
- Unmount and commit.
http://www.easy-share.com/1917450145/IMG-20110815-00019.jpg
Hi, you use a rather ungainly method of finding current drive.
Wouldn’t %cd:~0,3% work equally well?
I’m off to try this so I’ll get back to you if it works.
Ah, right well.
Now I get it. Unless you mount and insert the portable apps into the wim %cd:~2% won’t be looking in the right place. Which is why you were searching through the drives.
I set up my USB stick according to your instructions and was able to boot winpe without any problems.At first glance it looked good: I had the grey winpe-GUI in front of me and the typical DOS-window.Unfortunately PSTart would not appear-the reason: I do not have access to the bootable winpe-USBstick – the drive itself is not available!I tried several “letters”(in the DOSbox) starting with “c:” which is the win7-system reserved partition.”d:” not a valid filesystem.”e:” turns out to be my original c-drive and f: is another memory card…..but there is absolutely no letter available for my winpe-drive.I checked the contents of every drive with “dir” but no luck.Strange! It gets even more strange when I boot normally into Win7 (with the USBstick still connected)and Win7 will not recognize the USBstick-error message “unknown device”.But removing the USBstick and inserting it again causes no problem and I have full access to the drive…..any idea?
sorry about my english-my native language is german
HaPe, sounds like you need another UFD. I’d hazard that Winpe doesn’t do as many checks to insure the validity of the drive and the section (sectors?) that are failing aren’t the boot sectors.
Thanks for your reply Ben!
Iam going to repeat the whole procedure on a different USB stick.
First of all: it works.My USB stick is fine.The trouble with my system is ,if I boot an operating system from the USBstick,the bootet system will then recognize all connected devices like hdd,additional USBsticks etc BUT not the USBstick I bootet from.It also happens with Linux as I realized yesterday.Solution:disconnect and re-insert
while Win7PE is running,then I can browse manually to my PSTart folder….This worked fine with Win7PE(I guess it’s completely in RAM) but caused “minor”trouble with Linux.
It seems to me I am the only one with that problem – I am going to check my USB stick on a “not-Dell” system…
Did you check drive X:? WinPE should be there.
Sorry – I am late with my response….
Yes I tried drive “X” but to no avail.Dir-command comes up with some basic folders but not the ones I need.As I wrote in my previous mail:Removing the USBstick and reconnecting it solves the problem.For some reasons Windows loses access to the USBstick during boot – but only to the one I am booting from.Another guy told me he once had the same problem on an XP-system – don’t really know what’s going on.
Strange. Maybe you just use another USB stick before you waste too much time on this.
I haved a netbook that I wanted to run BartPE and Ghost with an external CD Drive to make a backup image but it wouldn’t work. I made a usb drive from your artical and added ghost to it and it worked great. The only issue I ran in to was I had to add the CD\ command to the Startnet.CMD because of a G is not a valid command error
Now I have the piece of mind of having a backup
Thank You
Thanks a ton for the write-up, very helpful so far. But I am having the same issue as others. When I boot the USB drive it works just fine except PStart does not start. A cmd window opens and I see the contents of the startnet.cmd file and everything looks fine but no PStart.
I have PStart.exe on the root of the USB drive.
Any idea where the extra spaces are in the command that Pettson on reply 10 mentions?
When I try to run the full command from cmd window I get the message “%%p was unexpected at this time” From changing the command a few times its talking about the very first %%p, after for. Not sure if this is a valid test of anything or even what this variable does so not sure what to change it to.
Like HaPe mentions, I am able to dir the X: drive but there is only a limited amount of folders, Program Files, Users and Windows. Nothing else. I cant see x:\pstartexe or the tools folder I created.
I am using Win7 32bit. and have tried with 3 different usb sticks
I was also having problems from Deployment Tools Command Prompt when messing around. I would get the error
“Error: 0xc1420127″: The specified image in the specified wim is already mounted for read/write access.
When unmount doesn’t work. Try this command: DISM /cleanup-wim
Also make sure you don’t have any windows open to the c:\img directory when running the unmount. If the directory stays around and you still get the error above, delete the dir manual and remove it from the recycle bin
Going to try RocketDock
Steve, Pstart can’t be in on X: because this is the Windows PE root folder. The task of the batch script is to find the drive letter where Windows PE mounted your USB stick. You can try to find the drive letter manually by checking all drive letters. There were some spaces in the batch script and I removed them now. But I doubt that this was the cause of the problem. You can also try to copy the batch script manually.
Thanks for the reply. Pstart and all my other tools are being assigned to the E: drive but it is not starting when the system boots still.
I double-checked my startnet.cmd against yours and they look identical. I also tried to re-copy it was well
I can go in and start it manually and then it seems to work just fine
Trying to mess around with Rocketdock also but cant find a good guide on that either as it appears the developers have moved on
@ Steve
Hey man, I saw that you were having problems with PStart not automatically loading.
I noticed that you said that you Installed the it in the root of your flash drive.
Michael recommended that we create folders for every program that we installed on our flash drives.
If you copied the script word for word into that startnet…. then it is looking for the .exe file located within the folder.
So in other words if you create a new folder and name it PStart, and then move PStart.exe inside of it than you should be set.
Good luck bro!
Thanks for the reply. I initially changed the path in the script from \PStart\PStart.exe to just \PStart.exe and after having problems I moved it to a folder named PStart and changed the script again.
I still cant get PSstart to start on boot
I am trying to run the command from a cmd line after the system has booted to see if it gives me any information and here is what I see
You have to change the variables from %% to just a single % to run it from cmd line
The usb gets assigned to the E: drive in this example so I am only including that line.
So here is the output
if exist e:\Pstart\ set w=e %w:\Pstart\Pstart.exe:\PStart\Pstart.exe
if I change %w% to %w I get
if exist e:\Pstart\ set w=e %w:\Pstart\Pstart.exe
So it seems like the issue is with the variable w not being replaced with the correct value, e in this case
Sorry if this is rambling
This article was helpful to me, thanks. Gave me a few ideas.
Something I found useful is the ability to set a custom shell when WinPE starts up instead of messing with the startnet.cmd file to add a program like PStart to launch:
Winpeshl.ini controls whether a customized shell is loaded in Windows PE instead of the default Command Prompt window. To load a customized shell, create a file named Winpeshl.ini and place it in %SYSTEMROOT%\System32 of your customized Windows PE image. The .ini file must have the following section and entry.
[LaunchApp]
AppPath = %SYSTEMDRIVE%\myshell.exe
[LaunchApps]
%SYSTEMDRIVE%\mydir\application1.exe, -option1 -option2
application2.exe, -option1 -option2
This is also handy because the default shell is the command prompt window, and if you close it you get a reboot. Instead, with this method, your launcher is your shell and closing it will reboot (handy with RocketDock, as it’s harder to accidentally close).
To adapt this for ease of use with a flash drive and being able to add other apps without redoing your WIM each time, you can still make the edit to startnet.cmd to identify the flash drive’s letter (the “for %%p in (a b c d…” line) in the article, and then use the resulting variable instead of %SYSTEMDRIVE% (%w% instead, i.e. %w%:\PStart\Pstart.exe as your shell).
I followed your instructions to create a Win PE 3.0 bootable USB thumb drive with PStart called from the startnet.cmd file during startup. From PStart I use ghost32.exe v11.5.1 to backup and restore laptop drives and I’ve done several backups/restores without any problems. I’ve done this on Win7 and WinVista. Today I ran into a problem trying to backup my Mom’s new HP Pavilion dv6. I figured this might be because the new laptop was running Win7 SP1 code base (WinPE 3.1) rather than just the standard Win7 code base (WinPE 3.0). So I downloaded the WAIK supplment for Win7 SP1 and followed the same instructions to create a new bootable USB thumb drive using the PE 3.1 environment and I get the same results. In both cases, when the thumb drive is plugged into her computer, it boots, then runs the ‘wininit’ (startnet.cmd) but then fails to call PStart.exe. This seems to be a problem with the script determining the drive letter of the USB key, however if I use the exact same key in my Mom’s netbnook PC, PStart launches just fine. In fact, I’m backing up her PC as we type this. I’m at a loss as to why PStart doesn’t launch and I really want to back up her new laptop before it gets all jacked up. Any assistance you can provide would be greatly appreciated. Thanks!
By the way, after reading through the entire thread, it appears I’m experiencing the same problem as described in posts 60-66 and 68 above.
Again, I also think PStart doesn’t seem to work in a 64-bit environment. Would really like to have a solution to this. The problem is as stated above: even though you boot from the USB drive, no drive letter is assigned to the USB drive after boot. In fact, using your startnet.cmd script, you are setting the environment variable called ‘w’. If you type ‘set’ at the X:\windows\system32 prompt after boot, you will in fact see that no variable ‘w’ has been set, even after the script runs (validated by removing ‘@echo off’ from beginning of script). For now I guess I’ll have to resort to adding tools through imagex, though the PStart method is preferred so that we don’t have to go through that hassle for adding new tools. Thanks again for your work on this, hopefully we can find a resolution soon.
Thanks for this Michael – very useful
I have a problem that does not appear to have been covered above.
If I leave ‘startnet.cmd’ unchanged with just the ‘wpeinit’ command then when I boot then wpeinit runs to completion and leaves me with a useable command prompt at ‘x:\windows\system32>’. All as expected.
When I add your lines to run PStart that part works and PStart is automatically started on boot, but wpeinit hangs and never reaches the command prompt. Any ideas why this is happening and how to allow wpeinit to complete as well as getting PStart running as well?
The cursor appears again after you closed PStart. You can also add “start” to the command that starts PStart:
start %w%:\PStart\PStart.exe
Thanks Michael,
I didn’t retry it but I am pretty sure that closing PStart didn’t return the cursor. However, prefixing the command with ‘start’ has done the trick.
Many thanks and happy New Year
Michael – No comment on posts 75/76?
David – Make sure PSTART is installed in a directory not in the root. Also, in startnet.cmd, make sure the PSTART directory is correct (case sensitive). My experience has been that the command prompt window does not return a cursor unless you exist PSTART (which seems to have grabbed control). Clicking “X” in the upper right corner doesn’t work, do a File|Exit.
Dan, difficult to say what caused the problem. Can you find the USB drive manually?
No, I cannot find the USB drive manually. I checked every single drive letter. When a drive letter ‘registered’, I did a ‘DIR’ to validate contents of the drive. The USB plain old is not available… even though WinPE boots from the same USB, the USB itself is not assigned a drive letter after WinPE boots and therefore is not available to run programs from. This seems to be the same on a couple of new Win7 laptops I tried it on… but if I take the same USB and use it on another Win7 laptop, it works just fine (no changes to startnet.cmd or anything else).
Michael, thanks for the great advice but unfortunately I have an issue that is a bit more complicated. I’m working on a Motion Computing CL 900 tablet where the user entered a password using the touch screen and (must have) entered it incorrectly (no way of telling where he messed up). This was his tablet and he was the admin on it with no other admin accounts enabled. The CL 900 has one USB interface but if you use the bootable USB stick, you cannot then swap over to the USB keyboard and as far as I can tell, the touch screen interface is disabled in Win PE.
I was intending to use NTPWEdit but I can’t do anything in Win PE without the keyboard. Is there some way run a script that will execute NTPWEdit? I have looked to see if others have had success loading the touch screen drivers using Win PE and it sounds like the answer is no.
Thoughts?
Jeff, if you just want to reset the admin password, I would try this. It is more likely that the Windows 7 setup has the right keyboard driver for the touch screen. Of course, you first have to create a bootable USB stick with the Windows 7 installation DVD. You will find many instructions for this on the web. Most of them are for netbooks. You could also try a USB hub, so you can connect the USB keyboard and the USB stick simultaneously.
Dan, this appears to be a driver issue. I would try another USB stick.
Michael, thanks for the pointer, but in this case the admin account is NOT enabled on this tablet. There is just a single account (the user’s) which has admin privileges (this was his tablet, I’m just trying to help him out). I didn’t think the Sticky Keys would work for a user admin account, only the Win admin account. Am I incorrect? I should have mentioned I followed your write-ups to create a bootable USB stick with Win PE installed (and NTPWEdit among other tools). I have thought about the USB hub but was worried it wouldn’t work while trying to boot from that same hub.
Jeff, the Sticky Keys trick works for every Windows account.
Hi Michael,guidance me about create graphical WinPE for Win7
Tnx
i have a window computer not sure of what type though i think its windows 7 i dont have a usb or dvd or cd how do i access my main user account with out them items im corrently on my computer just on another guess account can someone please help me?
@Reza: You just commented to ask for the very thing the article addresses?
@taya: Well, you have to find out what version you are running and avoid run on sentences. Try ‘win+r’, ‘msinfo32′. That should clear the version.
Is it your computer or is it managed by someone else, say work?
What are you trying to do?
Thanks for this. I use this basis of this technique to launch an AutoIt executable, which has a simple menu of buttons with stuff such as start gimagex,reboot, apply a default .wim image to disk 0, fix bootloader etc.
It works on the majority of machines but there seems to odd Toshiba laptop model that when you boot, Win PE works find but it doesn’t find the other partition on the USB stick. So I have to use a second drive in those cases.
Michael,
This information has been incredibly helpful. In one day I have learned more about Bootable drives and configurations that I have in the last several years. I have come screeching halt, however, and require some assistance.
I have gone through all of your steps, from prepping the Bootable USB, to everything on this page up to getting PStart onto the drive. I found the hidden space right here; \PStart\ set w=%%p %w%:\PStart\PStart.exe (even before that I had just copy pasted what you had in the line directly in without changing it)
The line I did change is the \Pstart\Pstart.exe to just \PStart.exe because I didn’t make an independent folder. Could that be the issue?
Here is what happens; the grey background screen loads along with the command prompt and it says the following
X:\windows\system32>wpeinit
X:\windows\system32>
That’s it. That is where I am stuck. Like I said I have started over from scratch mutliple times, and redone everything manually etc…PLEASE help me, this project is very important to me and the knowledge you have put on this site is incredible!
Thank you for doing everything so far, and thank you for your time.
Eric,
I guess the problem is that you copied PStart to the root folder. I would create folder for it as I described it in the article.
That actually worked, you sir are a genius.
Now, how to get network drivers on there…I cannot map network drives to use the ghost client I put on there to image machines. Do you have a tutorial for that as well, I would be very interested in reading it.
Thank you again, and thank you for the incredibly fast response.
Mike,
What I have done is added a folder to my USB driver with drivers in it, and put the .exe for the network driver into PStart. It runs it perfectly without error, however, when I go into QDir, and try to add a network location it gives me a “problem starting shwebsvc.dll”
Any idea what that is?
Thank you.
Thank you Michael!
Hi this is GREAT So far I managed to use this to start a txt based menu.
Now, how can I use this call diskpart? The following below I tried doesn’t work.
diskpart /s @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:\utils\ set w=%%p %w%:\utils\utils\diskpartcmds.txt
Michael,
Not sure if this is normal behavior, but the cursor in the command window in PE seems to freeze on the wpeinit line (you can’t ctrl+C or break it to the next line). PStart works absolutely fine, but I’m wondering if I needed to go back into the command line, if there is a way to get it working. Thanks!
Brian, that is expected. Easiest way is to launch a new command prompt. You could add it to the PStart menu.
Excellent. Thanks again, Michael. Really oustanding information here.
Has anyone tried adding DBAN to the PStart items? I’m looking add a disk wipe utility as well.
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
@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!