jmueske Posted April 7, 2008 Share Posted April 7, 2008 (edited) I'm using a UFD (USB Flash Drive) with WinPE 2.0 and ImageX to deploy an XPe image. Here's what I'm doing:1) Install UFD and SATA hard disk into system with power off.2) Power on and boot PC to BIOS boot drive menu with F12, select UFD with WinPE 2.0 (both SATA drive and UFD are considerd hard drives by the BIOS).3) Use diskpart to prepare hard disk:diskpart /s d:\script.txtselect disk 0cleancreate partition primaryselect partition 1activeexit4) format c: /fs:ntfs /y /v:harddisk5) d:\imagex.exe /apply d:\filename.wim 1 c:I run into a problem when using a brand new harddisk compared to a previously initialized harddisk. Diskpart sees a previously initialized harddisk as "drive 0" and the UFD is "drive 1". Diskpart sees only the UFD as a "drive 0" when a brand new empty harddisk is installed. As you can imagine this messes up my diskpart script because it wipes my UFD clean when a new hard disk is installed.Can I get diskpart to look at both drive states the same way without externally initializing each harddisk? Ideally my scripts can "autosense" the harddisk in both drive conditions and work properly accordingly. Any ideas?Regards,John Edited May 21, 2008 by jmueske Link to comment Share on other sites More sharing options...
zorphnog Posted April 8, 2008 Share Posted April 8, 2008 This has been covered many times. Search: +diskpart +script Link to comment Share on other sites More sharing options...
jmueske Posted May 21, 2008 Author Share Posted May 21, 2008 (edited) Thanks for the tip. I've literally searched for hours and while I can find other diskpart issues, I cannot find one similar to my own. Can someone point me in the right direction, perhaps with a specific post?Regards,John Edited May 21, 2008 by jmueske Link to comment Share on other sites More sharing options...
WreX Posted May 22, 2008 Share Posted May 22, 2008 You could use a batch or similar file to utilize diskpart scripting to find what disk # your hard drive or UFD device is and create your clean and partition script accordingly. The easiest way is if you know the size of your UFD device will always be the same. Then you could:1. Run a diskpart script that runs the "list disk" command and read the output2. Look for the line with the size value of your UFD device, and find the "Disk #" value for that device3. Create the diskpart script to clean and partition using the other disk #Here's an example of a batch file for a 256MB UFD that shows up as 246MB in diskpart:echo list disk > X:\ListDisk.txtFOR /F "tokens=2,4" %%i IN ('diskpart /s X:\ListDisk.txt') DO @IF /i %%j == 246 SET UFDDISK=%%iIF DEFINED UFDDISK IF %UFDDISK%==0 SET THEDISK=1IF DEFINED UFDDISK IF %UFDDISK%==1 SET THEDISK=0IF DEFINED UFDDISK echo select disk %THEDISK% > X:\PartHD.txtIF DEFINED UFDDISK echo clean >> X:\PartHD.txt...IF DEFINED UFDDISK diskpart /s X:\PartHD.txt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now