Coucher Posted June 27, 2007 Share Posted June 27, 2007 Guys, I've run into a problem that I need some help with. I'm not using an image server to do imaging. I use an image hdd (80gb hdd with WinPE and all my WIMs on it). All of my imaging is done on laptops (IBM/Lenovo Thinkpads to be exact). I put the image hdd in an ultrabay tray (removable hdd tray that goes into the CD/DVD bay) and into the Thinkpad. F12, select hdd1 as the boot device, and boot into PE. Works great and is VERY fast. Once PE loads I of course am at an X: prompt. I change to a C: prompt which is my PE hdd and then execute a CMD file(partition.cmd) which starts diskpart /s partition.txt which does the following:select disk 0cleancreate partition primary size=10000select partition 1activeformat FS=ntfs label="C_Drive" quickexitNow I'm back at my PE hdd C: prompt. I then have several CMD files for automating the image process based on the specific model of the machine.The problem I'm running into is that it's a 50/50 shot once you're actually in PE as to how PE see's the hdd's, regardless of how the BIOS saw them. For instance the WinPE hdd is always hdd1 in the BIOS boot list, however sometimes once booted into PE, PE see's the hdd's the opposite way. The Thinkpad's hdd is hdd1 according to PE, and the image hdd is now hdd0, so when I execute the script to clean and format "hdd0" it ends up wiping the image disk if on that particular boot PE sees it as hdd0 rather than hdd1. I'm wanting to try to write some logic to do some fashion of check first before invoking the disk part command, but not really sure at which point to do so, or what information I can use to key off of. Thoughts?Thanks in advance. Link to comment Share on other sites More sharing options...
gadget Posted June 27, 2007 Share Posted June 27, 2007 pe does mix up the partitioning. When running diskpart, select drive 1 partition 1 and assign a new drive letter except c: then assign disk 0 partition 1 as c:.As a check, in your cmd file, do if exist c:\*.* or c:\[Wim Directory]\*.* goto blah blah if it contains data then do it for the other partition, if it finds a blank drive then use that drive letter to deploy your image to. Link to comment Share on other sites More sharing options...
Coucher Posted June 27, 2007 Author Share Posted June 27, 2007 pe does mix up the partitioning. When running diskpart, select drive 1 partition 1 and assign a new drive letter except c: then assign disk 0 partition 1 as c:.As a check, in your cmd file, do if exist c:\*.* or c:\[Wim Directory]\*.* goto blah blah if it contains data then do it for the other partition, if it finds a blank drive then use that drive letter to deploy your image to.I follow your logic above and agree with it. However the difficult thing is the drive letter never changes. Whether the "PE hdd" shows up in PE as hdd0 or hdd1, it still shows up as C: drive letter. So whatever error checking I do has to somehow identify whether it's hdd0 or hdd1. Link to comment Share on other sites More sharing options...
zorphnog Posted June 27, 2007 Share Posted June 27, 2007 (edited) Well the way I would do it is either through WMI or some file parsing. I don't know exactly what to query with WMI off the top of my head, so I'll explain the file parsing. Your PE HDD should have a unique disk ID that never changes. So I would use diskpart to get the device id of disk 0. Something like, diskpart /s gethdd0id.txt > output.txt:select disk 0detail diskParse through output.txt to see if the disk id matches your PE HDD. If it does then the local hdd is disk 1, if not its disk 0. Then create a new diskpart script based off your results from the parsing of output.txt. Edited June 27, 2007 by zorphnog Link to comment Share on other sites More sharing options...
IcemanND Posted June 29, 2007 Share Posted June 29, 2007 for /f "tokens=1,2 delims=:" %%a in ('diskpart /s disk.txt') do (if "%%a"=="Disk ID" (if NOT "%%b"=="YOUR DISK ID" (diskpart /s wipedisk0.txt) else (diskpart /s wipedisk1.txt)disk.txtselect disk 0detail diskwipedisk0.txtselect disk 0cleancreate partition primary size=10000select partition 1activeformat FS=ntfs label="C_Drive" quickexitwipedisk1.txtselect disk 1cleancreate partition primary size=10000select partition 1activeformat FS=ntfs label="C_Drive" quickexit 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