xcellweb Posted May 27, 2009 Posted May 27, 2009 how can i boot off my usb pen drive in to winpe2 but make sure the pen drive does not take the drive letter C if there is a clean hard drive in the systemso when my pen drive boots it automatically goes to C but i wish it to go to a different drive letter.so that my disk part script can do it's job.
IcemanND Posted May 27, 2009 Posted May 27, 2009 Use diskpart to re-letter your USB drive.The boot path of the usb drive (or the letter it was assigned, can be found in the registry at:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PEBootRamdiskSourceDrive
Tripredacus Posted May 27, 2009 Posted May 27, 2009 I've run into the same problem on note/netbooks that have a realtek card reader in them. They get assigned the first available drive letter even if you set it in the BIOS to be recognized as a FDD. I have a theory, since I will have to do this as well, but I haven't scripted it out or tried to use it yet. Its on my list of things to do for my recovery partition project. So here is my idea and you can try it out:Use Diskpart to reassign the drive letter to something else. Example:sel vol cassign letter=ssel disk 0cleancreate part priactiveformat fs=ntfs quickassign letter=cThe first two lines are all you would need to change the drive letter. These commands are known to work in Win PE 2.x. I have not tested older or newer PE versions. You don't have to change the C to S, change it to whatever letter will be available.
IcemanND Posted May 27, 2009 Posted May 27, 2009 Only problem with that is if C was the hard drive you wanted to image because it wasn't blank and got a letter, it will now be S and get cleaned but you won't know your USB devices letter. May not be an issue depends upon how or if you use your USB device during your imaging/deployment process.
Tripredacus Posted May 27, 2009 Posted May 27, 2009 In my case, if the HDD is C and I format it and make it C again, I won't care what the UFD's drive letter is because most importantly, it isn't going to be C.
WreX Posted May 27, 2009 Posted May 27, 2009 (edited) Whenever I boot into PE from CD or locally I run two batch files via startnet.cmd, so I'm not sure if this will help when booted from a USB disk. The first changes the CD / DVD drive that has the bootable PE CD (label "CD_ROM") to K:, the second checks for C:, D:, and E: (the only hard drive partitions I care about) to be on Disk 0 and changes them to P:, Q:, and / or R: if they're not.Changes the CD / DVD drive with the bootable PE CD to K:@echo offecho list volume > X:\ListCD.txtFOR /F "tokens=2,4" %%i IN ('diskpart /s X:\ListCD.txt') DO @IF /I %%j == CD_ROM SET CDROMVOL=%%iIF DEFINED CDROMVOL echo select volume %CDROMVOL% > X:\ChangeCD.txtIF DEFINED CDROMVOL echo assign letter=K: >> X:\ChangeCD.txtIF DEFINED CDROMVOL diskpart /s X:\ChangeCD.txtChanges C:, D:, and / or E: to P:, Q:, and / or R: if not on Disk 0@echo offecho list volume > X:\ListVol.txtdiskpart /s X:\ListVol.txt > X:\ListVol.datFOR /F "tokens=2,3" %%i IN (X:\ListVol.dat) DO @IF /I %%j==C SET CVOL=%%iFOR /F "tokens=2,3" %%i IN (X:\ListVol.dat) DO @IF /I %%j==D SET DVOL=%%iFOR /F "tokens=2,3" %%i IN (X:\ListVol.dat) DO @IF /I %%j==E SET EVOL=%%iIF DEFINED CVOL goto FINDCVOLIF DEFINED DVOL goto FINDDVOLIF DEFINED EVOL goto FINDEVOLgoto DONE:FINDCVOLecho select vol %CVOL% > X:\CVOL.txtecho detail vol >> X:\CVOL.txtdiskpart /s X:\CVOL.txt > X:\CVOL.datFOR /F "tokens=2,3" %%i IN (X:\CVOL.dat) DO @IF /I %%j==Online SET CDISK=%%iFOR /F "tokens=2-4" %%i IN (X:\CVOL.dat) DO @IF /I %%j.%%k==No.Media SET CDISK=%%iIF DEFINED CDISK goto CHANGECVOLIF DEFINED DVOL goto FINDDVOLIF DEFINED EVOL goto FINDEVOLgoto DONE:CHANGECVOLecho select vol %CVOL% > X:\CFIX.txtecho assign letter=P >> X:\CFIX.txtdiskpart /s X:\CFIX.txtIF DEFINED DVOL goto FINDDVOLgoto DONE:FINDDVOLecho select vol %DVOL% > X:\DVOL.txtecho detail vol >> X:\DVOL.txtdiskpart /s X:\DVOL.txt > X:\DVOL.datFOR /F "tokens=2,3" %%i IN (X:\DVOL.dat) DO @IF /I %%j==Online SET DDISK=%%iFOR /F "tokens=2-4" %%i IN (X:\DVOL.dat) DO @IF /I %%j.%%k==No.Media SET DDISK=%%iIF DEFINED DDISK goto CHANGEDVOLIF DEFINED EVOL goto FINDEVOLgoto DONE:CHANGEDVOLecho select vol %DVOL% > X:\DFIX.txtecho assign letter=Q >> X:\DFIX.txtdiskpart /s X:\DFIX.txtIF DEFINED EVOL goto FINDEVOLgoto DONE:FINDEVOLecho select vol %EVOL% > X:\EVOL.txtecho detail vol >> X:\EVOL.txtdiskpart /s X:\EVOL.txt > X:\EVOL.datFOR /F "tokens=2,3" %%i IN (X:\EVOL.dat) DO @IF /I %%j==Online SET EDISK=%%iFOR /F "tokens=2-4" %%i IN (X:\EVOL.dat) DO @IF /I %%j.%%k==No.Media SET EDISK=%%iIF DEFINED EDISK goto CHANGEEVOLgoto DONE:CHANGEEVOLecho select vol %EVOL% > X:\EFIX.txtecho assign letter=R >> X:\EFIX.txtdiskpart /s X:\EFIX.txt:DONEIf you want to use it you can mess around with the commands while in PE to see for yourself what's being parsed from the diskpart commands. In the second script, the line that can have the "Online" or "No Media" values will have "* Disk 0" at the beginning if it's on Disk 0, but no * if it's not. If it's not Disk 0, the 2nd token would be the disk #, and the third "Online" or the third and fourth "No Media". If a disk # is found, the volume number is used to change the drive letter. I mainly had to do this because built-in storage card readers were using drive letters I needed if the disk was empty. Edited May 27, 2009 by WreX
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now