Sign in to follow this  
Followers 0
ImageN00B

Diskpart error when imaging Win7

6 posts in this topic

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

copy u:\test.wim d:

x:\imagex.exe /apply d:\test.wim 1 d:

d:\windows\system32\bcdboot d:\windows

exit

During the diskpart it calls to a text file for the diskpart commands noting:

select disk 0

clean

create partition primary size=80

select partition 1

format fs=ntfs label="system" quick

assign letter=C

active

create partition primary

select partition 2

format fs=ntfs label="windows" quick

assign letter=D

select disk 1

select partition 1

assign letter=U

exit

It 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!?!?!

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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!?!?

0

Share this post


Link to post
Share on other sites

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:\windowsexit

clean.txt:

select disk 0cleanexit

part11.txt

select disk 1select partition 1assign letter=Uexit

part01.txt:

select disk 0create partition primary size=80select partition 1format fs=ntfs label="system" quickassign letter=Cactiveexit

part02.txt:

select disk 0create partition primaryselect partition 2format fs=ntfs label="windows" quickassign letter=Dexit

And see what happens.

Notwithstanding your successful experiments, if not downright criminal :w00t::ph34r: 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 :whistle:.

jaclaz

0

Share this post


Link to post
Share on other sites

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:

diskpart

sel disk 0

clean

create part pri

sel part 1

assign letter c:

active

exit

format c: /q /y /fs:ntfs /v:Windows

imagex /apply x:\windows.wim 1 c:

c:\windows\system32\bcdboot c:\windows /s c:

exit

Work 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!

0

Share this post


Link to post
Share on other sites

I think your problem is the computer, type list disk in diskpart and make sure you are selectic the correct disks.

0

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.