ImageN00B Posted August 8, 2013 Posted August 8, 2013 I am attempting to run a light-touch to unattended imaging process from a USB, however i run into an error.I am running an error during the assignment of a drive letters several lines into my batch script.I have a 2 part imaging system that i call a batch file, and it runs through and is supposed to apply my wim as an image.During the part that it calls to for diskpart as part of my imaging i get an error.The initial batch is as follows:diskpart /s part2.txtcopy u:\test.wim d:x:\imagex.exe /apply d:\test.wim 1 d:d:\windows\system32\bcdboot d:\windowsexitDuring the diskpart it calls to a text file for the diskpart commands noting:select disk 0cleancreate partition primary size=80select partition 1format fs=ntfs label="system" quickassign letter=Cactivecreate partition primaryselect partition 2format fs=ntfs label="windows" quickassign letter=Dselect disk 1select partition 1assign letter=UexitIt goes throught the script all the way until it tries to assign drive letter D, then it throws an error.Virtual Disk Service error:The specified drive letter is not free to be assigned.Thusly bunking my entire automation.Everything works flawlessly if i run the entire diskpart section by hand, however it will not work in a diskpart batch.HELP!?!?!
jaclaz Posted August 9, 2013 Posted August 9, 2013 It is not at all clear to me your setup and the actual disk order. And it seems to me like you are installing the Windows to the D: drive (while normally this is done to the C: one). Can you try to explain/detail the general idea and setup? If you boot from the USB, normally that device would be disk 0 (first disk) and the internal disk would be "shifted" to disk 1 but disk order in PE's is somewhat not "reliable", disk order (and consequently drive lettering) may change. It is very possible that this happens, as a rule of thumb it would be "better" to check the environment (and disk order and drive letters already assigned) at the time you run diskpart.exe. Something *like* this: http://www.msfn.org/board/topic/10905-change-drive-letters-to-your-liking/ http://www.msfn.org/board/topic/123929-updated-batch-file-for-ordering-drive-letter-shifting/ is normally useful. As a side note (and only marginal) there is no need to have a separate diskpart script, it is possible to embed it in the same batch file, see (JFYI): http://www.msfn.org/board/topic/126069-updated-on-feb-27-2011-ordering-messed-drive-letter-batch-file/?p=817142 http://www.msfn.org/board/topic/126069-updated-on-feb-27-2011-ordering-messed-drive-letter-batch-file/?p=817388 jaclaz
ImageN00B Posted August 9, 2013 Author Posted August 9, 2013 I'll clarify...I created a WAIK-based WINPE bootable UDF to USB, i placed my two scripts onto the USB, along with my image (captured) WIM file.So i'm booting to the USB, and by default from what i'm seeing on 5 different computers, is that setting the booting the USB as DISK 1, by the configs of the WINPE.I run the batch at launch by typing in "part1" which executes the batch file.Line 1 of the file calls to the DISKPART script, but by the time it attempt to quick format the drive and assign it as "D", it reboots.(I have no idea why, as i've not called to do so in the script)If i follow the scripts line for line, it works perfectly. If i execute the batch, it blows up and reboots to the computers.I REALLY don't want to have to do this manually, as everything i've seen online says you can do this through scripts.I'm just not seeing it.HELP!?!?
jaclaz Posted August 9, 2013 Posted August 9, 2013 Good, but still you didn't answer my questions.Is there a specific reason why you want/need to install the windows on "D:"?Anyway, when you have this kind of strange issues, try to separate things as much as possible (there will be time enough later to re-assemple them together) and insert in the middle some checks.Example:diskpart /s clean.txtECHO clean.txt ranmountvol | FIND ":\"PAUSEdiskpart /s part11.txtECHO part11.txt ranmountvol | FIND ":\"PAUSEdiskpart /s part01.txtECHO part01.txt ranmountvol | FIND ":\"PAUSEdiskpart /s part02.txtECHO part02.txt ranmountvol | FIND ":\"PAUSEcopy u:\test.wim d:x:\imagex.exe /apply d:\test.wim 1 d:d:\windows\system32\bcdboot d:\windowsexitclean.txt:select disk 0cleanexitpart11.txtselect disk 1select partition 1assign letter=Uexitpart01.txt:select disk 0create partition primary size=80select partition 1format fs=ntfs label="system" quickassign letter=Cactiveexitpart02.txt:select disk 0create partition primaryselect partition 2format fs=ntfs label="windows" quickassign letter=DexitAnd see what happens.Notwithstanding your successful experiments, if not downright criminal I find EXTREMELY dangerous to select a disk and "clean" it with diskpart in an automated setup without first checking if it is the "right" disk .jaclaz
gustavo21 Posted September 10, 2013 Posted September 10, 2013 Good, but still you didn't answer my questions.Is there a specific reason why you want/need to install the windows on "D:"?Hi! I allways install Windows in C:, never did de system part.Basicaly, i do this:diskpartsel disk 0cleancreate part prisel part 1assign letter c:activeexitformat c: /q /y /fs:ntfs /v:Windowsimagex /apply x:\windows.wim 1 c:c:\windows\system32\bcdboot c:\windows /s c:exitWork great, never had a problem. I just have another script more complex because many notebooks have cdrom like disk 1 or some card reader also. Saludos!
gustavo21 Posted September 10, 2013 Posted September 10, 2013 I think your problem is the computer, type list disk in diskpart and make sure you are selectic the correct disks.
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