Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

prevent pen drive from taking letter C

- - - - -

  • Please log in to reply
5 replies to this topic

#1
xcellweb

xcellweb

    Newbie

  • Member
  • 17 posts
  • Joined 22-September 05
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 system

so 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.


How to remove advertisement from MSFN

#2
IcemanND

IcemanND

    MSFN Junkie

  • Super Moderator
  • 3,266 posts
  • Joined 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag
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

#3
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,923 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

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 c
assign letter=s
sel disk 0
clean
create part pri
active
format fs=ntfs quick
assign letter=c

The 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.
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#4
IcemanND

IcemanND

    MSFN Junkie

  • Super Moderator
  • 3,266 posts
  • Joined 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag
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.

#5
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,923 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

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.
MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#6
WreX

WreX

    Junior

  • Member
  • Pip
  • 84 posts
  • Joined 26-October 07
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 off
echo list volume > X:\ListCD.txt
FOR /F "tokens=2,4" %%i IN ('diskpart /s X:\ListCD.txt') DO @IF /I %%j == CD_ROM SET CDROMVOL=%%i
IF DEFINED CDROMVOL echo select volume %CDROMVOL% > X:\ChangeCD.txt
IF DEFINED CDROMVOL echo assign letter=K: >> X:\ChangeCD.txt
IF DEFINED CDROMVOL diskpart /s X:\ChangeCD.txt

Changes C:, D:, and / or E: to P:, Q:, and / or R: if not on Disk 0
 
@echo off

echo list volume > X:\ListVol.txt
diskpart /s X:\ListVol.txt > X:\ListVol.dat

FOR /F "tokens=2,3" %%i IN (X:\ListVol.dat) DO @IF /I %%j==C SET CVOL=%%i
FOR /F "tokens=2,3" %%i IN (X:\ListVol.dat) DO @IF /I %%j==D SET DVOL=%%i
FOR /F "tokens=2,3" %%i IN (X:\ListVol.dat) DO @IF /I %%j==E SET EVOL=%%i

IF DEFINED CVOL goto FINDCVOL
IF DEFINED DVOL goto FINDDVOL
IF DEFINED EVOL goto FINDEVOL
goto DONE

:FINDCVOL
echo select vol %CVOL% > X:\CVOL.txt
echo detail vol >> X:\CVOL.txt
diskpart /s X:\CVOL.txt > X:\CVOL.dat
FOR /F "tokens=2,3" %%i IN (X:\CVOL.dat) DO @IF /I %%j==Online SET CDISK=%%i
FOR /F "tokens=2-4" %%i IN (X:\CVOL.dat) DO @IF /I %%j.%%k==No.Media SET CDISK=%%i
IF DEFINED CDISK goto CHANGECVOL
IF DEFINED DVOL goto FINDDVOL
IF DEFINED EVOL goto FINDEVOL
goto DONE

:CHANGECVOL
echo select vol %CVOL% > X:\CFIX.txt
echo assign letter=P >> X:\CFIX.txt
diskpart /s X:\CFIX.txt
IF DEFINED DVOL goto FINDDVOL
goto DONE

:FINDDVOL
echo select vol %DVOL% > X:\DVOL.txt
echo detail vol >> X:\DVOL.txt
diskpart /s X:\DVOL.txt > X:\DVOL.dat
FOR /F "tokens=2,3" %%i IN (X:\DVOL.dat) DO @IF /I %%j==Online SET DDISK=%%i
FOR /F "tokens=2-4" %%i IN (X:\DVOL.dat) DO @IF /I %%j.%%k==No.Media SET DDISK=%%i
IF DEFINED DDISK goto CHANGEDVOL
IF DEFINED EVOL goto FINDEVOL
goto DONE

:CHANGEDVOL
echo select vol %DVOL% > X:\DFIX.txt
echo assign letter=Q >> X:\DFIX.txt
diskpart /s X:\DFIX.txt
IF DEFINED EVOL goto FINDEVOL
goto DONE

:FINDEVOL
echo select vol %EVOL% > X:\EVOL.txt
echo detail vol >> X:\EVOL.txt
diskpart /s X:\EVOL.txt > X:\EVOL.dat
FOR /F "tokens=2,3" %%i IN (X:\EVOL.dat) DO @IF /I %%j==Online SET EDISK=%%i
FOR /F "tokens=2-4" %%i IN (X:\EVOL.dat) DO @IF /I %%j.%%k==No.Media SET EDISK=%%i
IF DEFINED EDISK goto CHANGEEVOL
goto DONE

:CHANGEEVOL
echo select vol %EVOL% > X:\EFIX.txt
echo assign letter=R >> X:\EFIX.txt
diskpart /s X:\EFIX.txt

:DONE

If 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 by WreX, 27 May 2009 - 09:00 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users