Community Pick: Many members of our community have endorsed this article.

Bootable USB (Local Imaging, DoD Wiping and More!)

IT_Crowd
CERTIFIED EXPERT
Published:
A bootable USB key can be very handy now-a-days. My favorite USB key consists of our Windows 7 image, network card drivers (to connect up to a Ghost server), the latest BIOS updates for all of our PCs and CopyWipe (to erase a retired PC)

Creating your Bootable Stick
To actually make your USB key, I like the HP USB Disk Storage Format Tool - its very easy to use. You will also need the files from a Windows 98 boot disk (www.bootdisk.com)

Ed Note:
That site is convenient, but we must say that licensing agreements are in effect and you should only install software for which you have valid licenses.

Menu Structure
All of the menu items for your USB key are stored within the config.sys file. Here is a sample:
[menu]
                      SUBMENU=LOCAL, Local: Deploy an image from USB
                      SUBMENU=NETWORK, Network: Connect to a Ghost server and deploy an image
                      SUBMENU=WIPE, DoD wipe this PC
                      SUBMENU=BIOS, BIOS Upgrades
                      

Open in new window


[menu] My top level - name is "menu" (though it can be named whatever you want).

SUBMENU denotes that this selection will take you to the next menu - it uses the [variable], [description] flags.
MENUITEM is an actual selection (the end of a selection tree). MENUITEM=[variable], [description]. All of the variables need to be stored at the end of the config.sys file for use in the autoexec.bat file
MENUCOLOR is nice if you want to change the color of your menus [textcolor],[backgroundcolor] (http://www.easydos.com/menucolor.html)

So...let's see the whole picture of the menu structure.
[menu]
                      SUBMENU=LOCAL, Local: Deploy an image from USB
                      SUBMENU=NETWORK, Network: Connect to a Ghost server and deploy an image
                      SUBMENU=WIPE, DoD wipe this PC
                      SUBMENU=BIOS, BIOS Upgrades
                      MENUCOLOR=7,1
                      
                      [NETWORK]
                      MENUITEM=B57, Broadcom NetExtreme - Precision T3500, T3400, 390, 380, 370
                      MENUITEM=B57a, Broadcom NetExtreme - Latitude D630, D620, D610, D600
                      MENUITEM=E100B, Intel 100B/S - Dimension 8300, 8250, 8200, 8100, 4550
                      MENUITEM=E1000, Intel 1000 - Optiplex 755, 960, 980 Latitude E4200, E6400
                      SUBMENU=menu, Return to the main menu
                      MENUCOLOR=7,1
                      
                      [LOCAL]
                      MENUITEM=WIN7BASE, Windows 7 Base
                      MENUITEM=WIN7CAD, Windows 7 CAD
                      MENUITEM=XPBASE, Windows XP Base
                      MENUITEM=XPCAD, Windows XP CAD
                      SUBMENU=menu, Return to the main menu
                      MENUCOLOR=7,1
                      
                      [BIOS]
                      SUBMENU=PRECISION, BIOS upgrades for the Dell Precision PCs
                      SUBMENU=OPTIPLEX, BIOS upgrades for the Dell Optiplex PCs
                      SUBMENU=MENU, Return to the main menu
                      MENUCOLOR=7,1
                      
                      [PRECISION]
                      MENUITEM=370_BIOS, BIOS UPGRADE: 370
                      MENUITEM=380_BIOS, BIOS UPGRADE: 380
                      MENUITEM=390_BIOS, BIOS UPGRADE: 390
                      MENUITEM=T3400_BIOS, BIOS UPGRADE: T3400
                      MENUITEM=T3500_BIOS, BIOS UPGRADE: T3500
                      SUBMENU=BIOS, Pick a new machine type
                      SUBMENU=menu, Return to the main menu
                      MENUCOLOR=7,1
                      
                      [OPTIPLEX]
                      MENUITEM=O755_BIOS, BIOS UPGRADE: O755
                      MENUITEM=O960_BIOS, BIOS UPGRADE: O960
                      MENUITEM=O980_BIOS, BIOS UPGRADE: O980
                      SUBMENU=BIOS, Pick a new machine type
                      SUBMENU=menu, Return to the main menu
                      MENUCOLOR=7,1
                      
                      [WIPE]
                      MENUITEM=DODWIPE, Load CopyWipe to DoD wipe a hard drive
                      SUBMENU=menu, Return to the main menu
                      MENUCOLOR=0,4
                      
                      [COMMON]
                      LASTDRIVE = Z
                      
                      [B57]
                      DEVICE=\B57\protman.dos /I:\B57
                      DEVICE=\B57\dis_pkt.dos
                      DEVICE=\B57\B57.dos
                      
                      [B57a]
                      DEVICE=\B57\protman.dos /I:\B57
                      DEVICE=\B57\dis_pkt.dos
                      DEVICE=\B57\B57.dos
                      
                      [E100B]
                      DEVICE=\E100B\protman.dos /I:\E100B
                      DEVICE=\E100B\dis_pkt.dos
                      DEVICE=\E100B\E100B.dos
                      
                      [E1000]
                      DEVICE=\E1000\protman.dos /I:\E1000
                      DEVICE=\E1000\dis_pkt.dos
                      DEVICE=\E1000\E1000.dos
                      
                      [370_BIOS]
                      
                      [380_BIOS]
                      
                      [390_BIOS]
                      
                      [T3400_BIOS]
                      
                      [T3500_BIOS]
                      
                      [O755_BIOS]
                      
                      [O960_BIOS]
                      
                      [O980_BIOS]
                      
                      [WIN7BASE]
                      
                      [WIN7CAD]
                      
                      [XPBASE]
                      
                      [XPCAD]
                      
                      [DODWIPE]
                      

Open in new window


Putting Code Behind the Menu
Great! So now that we have a menu setup, we can go into the AutoExec.bat file and put some code into our USB key.

Looking at the code above, let's say you navigate through the entire menu structure and end up picking BIOS Upgrade: T3500. The first section of code in my AutoExec.bat file is to check which option you picked. Your selection is stored as %CONFIG%. When you picked BIOS Upgrade: T3500, you selected the variable T3500_BIOS because MENUITEM=T3500_BIOS, BIOS Upgrade: T3500 (variable, description).

The first section of the AutoExec.bat file looks like this:
IF %CONFIG% == 370_BIOS GOTO 370_BIOS
                      IF %CONFIG% == 380_BIOS GOTO 380_BIOS
                      IF %CONFIG% == 390_BIOS GOTO 390_BIOS
                      IF %CONFIG% == T3400_BIOS GOTO T3400_BIOS
                      IF %CONFIG% == T3500_BIOS GOTO T3500_BIOS
                      IF %CONFIG% == O755_BIOS GOTO O755_BIOS
                      IF %CONFIG% == O960_BIOS GOTO O960_BIOS
                      IF %CONFIG% == O980_BIOS GOTO O980_BIOS
                      IF %CONFIG% == DODWIPE GOTO DODWIPE
                      
                      ...
                      
                      :T3400_BIOS
                      cd BIOS
                      T3400.exe
                      GOTO End
                      
                      :T3500_BIOS
                      cd BIOS
                      T3500.exe
                      GOTO End
                      
                      :O755_BIOS
                      cd BIOS
                      O755.exe
                      GOTO End
                      
                      ...
                      

Open in new window


This also assumes that you have a folder within your USB stick called BIOS and a file called T3500.exe.  After you select the T3500 BIOS upgrade, it will get to this section, hop down to the T3500_BIOS sub section and start executing code - first to navigate into the BIOS folder and second to execute the BIOS upgrade. Finally, once the BIOS upgrade is done, I tell it to go to the end - which exits the USB key.

So let's check out the entirety of the AutoExec.bat file:
IF %CONFIG% == 370_BIOS GOTO 370_BIOS
                      IF %CONFIG% == 380_BIOS GOTO 380_BIOS
                      IF %CONFIG% == 390_BIOS GOTO 390_BIOS
                      IF %CONFIG% == T3400_BIOS GOTO T3400_BIOS
                      IF %CONFIG% == T3500_BIOS GOTO T3500_BIOS
                      IF %CONFIG% == O755_BIOS GOTO O755_BIOS
                      IF %CONFIG% == O960_BIOS GOTO O960_BIOS
                      IF %CONFIG% == O980_BIOS GOTO O980_BIOS
                      IF %CONFIG% == D620_BIOS GOTO D620_BIOS
                      IF %CONFIG% == D630_BIOS GOTO D630_BIOS
                      IF %CONFIG% == E4200_BIOS GOTO E4200_BIOS
                      IF %CONFIG% == E6400_BIOS GOTO E6400_BIOS
                      IF %CONFIG% == E6410_BIOS GOTO E6410_BIOS
                      IF %CONFIG% == WIN7BASE GOTO WIN7BASE
                      IF %CONFIG% == DODWIPE GOTO DODWIPE
                      
                      GOTO GHOST
                      
                      :GHOST
                      SET TZ=GHO+06:00
                      prompt $p$g
                      \net\netbind.com
                      echo Loading Ghost...
                      C:
                      cd \ghost
                      GHOST.EXE -nousb
                      GOTO End
                      
                      :WIN7BASE
                      @echo off
                      SET TZ=GHO+06:00
                      rem prompt $p$g
                      rem \net\netbind.com
                      echo Loading Ghost...
                      C:
                      MOUSE.COM
                      cd \ghost
                      GHOST.EXE -clone,mode=restore,src=C:\win7b.gho,dst=2 -sure -rb
                      GOTO End
                      
                      :370_BIOS
                      cd BIOS
                      370.exe
                      GOTO End
                      
                      :380_BIOS
                      cd BIOS
                      380.exe
                      GOTO End
                      
                      :390_BIOS
                      cd BIOS
                      390.exe
                      GOTO End
                      
                      :T3400_BIOS
                      cd BIOS
                      T3400.exe
                      GOTO End
                      
                      :T3500_BIOS
                      cd BIOS
                      T3500.exe
                      GOTO End
                      
                      :O755_BIOS
                      cd BIOS
                      O755.exe
                      GOTO End
                      
                      :O960_BIOS
                      cd BIOS
                      O960.exe
                      GOTO End
                      
                      :O980_BIOS
                      cd BIOS
                      O980.exe
                      GOTO End
                      
                      :D620_BIOS
                      cd BIOS
                      D620.exe
                      GOTO End
                      
                      :D630_BIOS
                      cd BIOS
                      D630.exe
                      GOTO End
                      
                      :E4200_BIOS
                      cd BIOS
                      E4200.exe
                      GOTO End
                      
                      :E6400_BIOS
                      cd BIOS
                      E6400.exe
                      GOTO End
                      
                      :E6410_BIOS
                      cd BIOS
                      E6410.exe
                      GOTO End
                      
                      :DODWIPE
                      echo                                  WARNING!!!
                      echo.                
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      pause
                      C:
                      cd \DoDWipe
                      CopyWipe.EXE
                      GOTO End
                      
                      :End
                      Exit
                      

Open in new window


Using Ghost to Deploy an Image from your USB Key
You've probably noticed the Win7Base sections of code. This is setup to reference Ghost files to automatically load Ghost.exe and start imaging.

Ed Note:
Ghohst.Exe is a product of Symantec and is available here.
:WIN7BASE
                      @echo off
                      SET TZ=GHO+06:00
                      rem prompt $p$g
                      rem \net\netbind.com
                      echo Loading Ghost...
                      C:
                      MOUSE.COM
                      cd \ghost
                      GHOST.EXE -clone,mode=restore,src=C:\win7b.gho,dst=2 -sure -rb
                      GOTO End
                      

Open in new window

The Ghost executable should be located in USBKeyDriveID\Ghost. This also assumes that your filename is win7b.gho

Note:
I have found the the Ghost image filename NEEDS TO BE 5 characters long and the individual Ghost image spans should be no larger than 2GB (I have mine split to 1024MB). See your Ghost documentation for more information on creating an image.
Once this menu option is selected, Ghost is loaded, the image is selected and the imaging proceeds. Once the imaging is finished, the PC is rebooted and Windows 7 starts configuring. All of this is done automatically!

CopyWipe
I also like having CopyWipe on my USB stick in case I need to wipe a PC.   CopyWipe is a utility program available here:

    Free Drive Copy and Wiping Software -- CopyWipe™
    http://www.terabyteunlimited.com/copywipe.php
:DODWIPE
                      echo                                  WARNING!!!
                      echo.                
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      echo        Final Warning...DO NOT wipe hard drive 0 - it is the USB stick!!
                      pause
                      C:
                      cd \DoDWipe
                      CopyWipe.EXE
                      GOTO End
                      

Open in new window

The final warnings are nice because the drives just show up as Hard Drive 0 and Hard Drive 1.  Since you are booting off of the USB key - it is Hard Drive 0. Dont wipe it!  :)

Closing Comments
Well, that's about everything that I have in my bootable USB key. I'm sure there are different ways to go about some of this, but this is just my example. Feel free to leave comments or ask questions! I will try to help you as best as I can!  

Enjoy!

-IT_Crowd

1
6,165 Views
IT_Crowd
CERTIFIED EXPERT

Comments (1)

Sean Plemons Kelly, CISSPInformation Systems Security Engineer
CERTIFIED EXPERT

Commented:
IT_Crowd,

Well written! You may also consider adding in a minimum size for a drive in order to make this work properly.

Cheers!
Sean

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.