<

Making the ultimate Windows 7 boot disk

Published on
13,619 Points
6,819 Views
3 Endorsements
Last Modified:
Approved
Over the years, I have found many pieces of information that helped me in the building of a Windows 98 boot disk and it worked great. www.bootdisk.com was my favourite site, then along came Windows AIK.

For seasoned techs, this is nothing new.  For new techs just beginning a career, this may come in handy.

After searching and many nights of Googling I have decided to put my thoughts to paper and thus the creation of this how, for the ultimate Windows 7 boot disk.

First some quick notes:
Whenever you see <arch> you will need to substitute it for:
  x86 which is 32bit, ia64 or amd64 which is 64bit.  This is mandatory if you are on a 64bit or 32bit OS.

Credit should be given where credit is due:
EE member gerwinjansen correcting some issues I was having  with a command
EE member smckeown777 who thought of this idea as well and pointed me to an article listed above.

Every piece of information that you find below is nothing new.  I have simply trawled the internet for my own purposes and have put it together here, in one place

This article will take you through the following steps:
How to create and edit the WinPE boot disk image
How to configure the text based boot menu
How to add applications to your boot menu and create the bootable USB flash

How to create the WinPE boot menu

In order to begin, you will require:
Windows 7 installed
Next visit  microsoft.com and download the Windows 7 Automatic installation Kit(AIK)
Install the Windows 7 AIK
Now that installation is complete, open a command line window
Browse to this path

c:\Program Files\Windows AIK\Tools
You will now need to run the following commands
 
copype.cmd <arch> c:\winpe_<arch>

Open in new window

The above command will create a set of directories located in c:\WinPE_<arch>
We will now copy the boot.wim file which is the actual Windows boot image with this command:
copy c:\winpe_<arch>\winpe.wim c:\winpe_<arch>\ISO\sources\boot.wim

Open in new window

Now that we have our WinPE working enviroment setup, it is time to configure it.
In order for the boot menu to start we need to edit the boot.wim file
From a command line enter the following command:
Dism /Get-WimInfo /WimFile:c:\winpe_<arch>\ISO\sources\boot.wim

Open in new window

DISM WIM info
Locate the info highlighted here and replace <image name> in the next
Dism /Mount-Wim /WimFile:c:\winpe_<arch>\ISO\sources\boot.wim /Name:"<image name>" /MountDir:c:\winpe_<arch>\mount

Open in new window

Open Windows Explorer and browse to c:\winpe_<arch>\mount\Windows\system32
Look for a file named startnet.cmd and open it with Notepad
Add the following lines(the purpose of this is to launch the custom boot menu after WinPE loads
 REM Start boot menu
@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\menu.cmd

Open in new window

Next, we need to load your NIC drivers.  Without this step, your WinPE boot disk cannot access the network.  If you do not want to add drivers, you can skip to step
Open a command line
Enter the following command
Dism /Image:c:\winpe_<arch>\mount /Add-Driver /Driver:c:\<path_to_driver> /Recurse /ForceUnsigned

Open in new window

!!NOTE!! the /recurse switch will check all sub directories for drives.  The /ForceUnsigned switch will inject the driveler if it is not signed
Once you are finished inserting all of your drivers run this command:
Dism /Unmount-Wim /MountDir:c:\winpe_<arch>\mount /Commit
You have now completed entering your drivers and editing the startup command file

How to create and edit the WinPE boot menu

create a a directory called utils at the root of c:\winpe_<arch>\iso
In the utils directory, create file named menu.cmd
Open this file with notepad and enter the following and save the file:
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 X to EXIT.

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

Open in new window


How to add applications to the WinPE boot menu

All of the apps that are required are from www.portableapps.com
Download the following apps and extract them to the following directories
gimageX
c:\winpe_<arch>\iso\utils\gimagex

command Prompt Portable
c:\winpe_<arch>\iso\utils\commandPromptPortable

7-zip
c:\winpe_<arch>\iso\utils\7-zipPortable.exe

File Explorer
c:\winpe_<arch>\iso\utils\Explorer++Portable.exe
     

filezilla
c:\winpe_<arch>\iso\utils\filezillaPortable.exe

PuTTY
c:\winpe_<arch>\iso\utils\PuTTYPortable.exe

Crystal Disk Info Portable
c:\winpe_<arch>\iso\utils\CrystalDiskInfoPortable

Now that we have all files where we want them, it is now time to format the USB key and copy the data.
open the command prompt and run the following commands:
      
Insert a USB flash drive to your computer
     
Open a command line window
     
Enter the command diskpart
     
At the prompt, enter the command list disk
     
Diskpart will now display all the physical disks attached.  Locate the disk in the Disk ### column the belongs to your USB flash drive
     
Enter the command select disk <the disk#> and press enter
     
Enter the command  clean and press enter
     
Enter the command create partition primary and press enter
     
Enter the command  select partition 1 and press enter
     
Enter the command active and press enter
     
Enter the command format quick fs=fat32 and press enter
     
Enter the command  active and press enter
     
Enter the command exit and press enter
Diskpart commands
Copy the files to the USB drive using the following command:
xcopy c:\winPE_<arch>\ISO\*.* /e <drive>:\

Open in new window


Now, you're all done.

Oh so your BIOS does not support booting from USB?  Well you are in luck as the above compilation can be burned to CD or DVD.  

Here are the steps for a 32bit boot media
Open a command prompt
Enter the following commands
"c:\Program Files\Windows AIK\tools\<arch>\oscdimg -n -m -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso"

Open in new window

Here are the commands for ia64bit boot media
"c:\Program Files\Windows AIK\tools\<arch>\oscdimg -n -m -bc:\winpe_ia64\efisys.com c:\winpe_ia64\ISO c:\winpe_ia64\winpe_ia64.iso"

Open in new window


You can now use your favourite CD/DVD burning software to burn this ISO created for use.
3
Comment
Author:nappy_d
  • 4
5 Comments

Expert Comment

by:garryshape
Thanks a lot.
I am wondering though why would you want any of those portable apps in the WinPe environment? Like is 7zip useful when you're working with imagex?
Maybe I could see a portable web browser if that'd work in case you need to go online from the computer.
But I will modify this to make an image selection menu to choose between builds. So thanks again for the steps and open template.
0

Expert Comment

by:garryshape
Ok, how come when I follow this guide and create an ISO and burn to CD, imagex is not a valid command in the WinPE environment?
0

Expert Comment

by:garryshape
duh newb you have to CD to the CD/USB
0
LVL 32

Author Comment

by:nappy_d
Not white understandinding your "duh...." comment. Was that at yourself or at me :)

Also, 7zip would be great for uploading sets of files via ftp or via a browser. Know what I mean?

Did you want me to add some steps for a browser?

You could even makes sub menus to categorize your utilites menus.
0

Expert Comment

by:garryshape
lol sorry, I was calling myself a newb.

yeah the only thing I ran into since i had to do a CD ISO was this command has an error I think the typois to remove the : after the b

"c:\Program Files\Windows AIK\tools\<arch>\oscdimg -n -m -b:c:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso"
0

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Join & Write a Comment

Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month