Jump to content

Diskpart scripting question


Tripredacus

Recommended Posts

Currently I am evaluating the use of WDS to deploy images that contain a recovery partition. ATM I am imaging a test machine from which I will be testing out capturing methods, so I wrote up this quick script (yes literally wrote it on a pad of paper) for how I can structure my diskpart scripting during the deploy phase. Please review the following and LMK if you see anything I should revise or be aware of. The Volume IDs are the real ones I need to use.

Pre-image Diskpart script:

select disk 0
clean
create part pri size='62220' id='0x07'
select part 1
active
assign letter='c:'
format fs='ntfs' quick
create part ext size='14096' id='0x12'
select part 2
active
assign letter=d:'
format fs='fat32' quick

Post-image diskpart script:

select disk 0
select part 2
active
attributes set hidden
attributes set nodefaultdriveletter

Link to comment
Share on other sites


I don't see an issue with it. I am not quite sure why you are using the id=byte/guid. Please explain.

I assume you are doing desktops so you don't know need dynamically find the primary disk ID.

Link to comment
Share on other sites

Because we cannot use RE for XP recovery options, we use another method. This changes the drive ID to x12 instead of x07 so if we are to expect it to match previous computers we shipped out, we need to duplicate it as best as possible. We can already see the current ID with Ghost which shows the C drive to be 7 and the recovery partition to be 12.

Link to comment
Share on other sites

Alright I am manually testing this script and there appear to be some issues with it.

1. It won't let me assign the ID byte when creating the partition. I will instead set the partition ID during the cleanup phase by using 'attributes set id=0x12' instead.

2. When you create an extended partition, the default numbering for it is 0 (zero).

3. I cannot make part 0 active because it says it is not a data volume.

HELP: I need to insert the following after creating the extended partition?

create partition extended [offset=n] [noerr]

I will try it out, or is it recommended to create the logical partition instead of the extended one?

Also, obviously my cleanup script needs to be changed from selecting part 2 to part 0.

Link to comment
Share on other sites

New Diskpart script (revised)

select disk 0
clean
create part pri size=62220
select part 1
active
assign letter=c:
format fs=ntfs quick
create part ext size=14096
select part 0
create part log size=14096
select part 2
assign letter=d:
format fs=fat32 quick
exit

Revised Cleanup script

select disk 0
select part 1
attributes vol set hidden
attributes vol set nodefaultdriveletter
set id=12

I Was about to attempt a second time imaging but I somehow broke my WIM... looks like I am SOL for the moment. I will get to do more work on it next week when I can do a recapture again.

Anyways, I found my ID changing cmd in another thread I made someplace on this forum:

http://www.msfn.org/board/Imagex-question-t103807.html

Link to comment
Share on other sites

So far this isn't cloning properly because I am still doing something wrong. I just dropped the source image again (with ghost) and checked everything with diskpart. The second partition is listed as OEM type, but I can't find anything online to say how to create an OEM part with diskpart.

List part results:

PART # - TYPE - SIZE - OFFSET

Part 1 - Primary - 61GB - 32KB

Part 2 - OEM - 14GB - 61GB

List vol results:

VOL# - Ltr - FS - TYPE - SIZE - Status - Info

0 - C - NTFS - Partition - 61GB - Healthy -

1 - - FAT32 - Partition - 14GB - Healthy - hidden

Detail Part 1

Type: 07

Hidden: no

Active: Yes

Detail Part 2

Type: 12

Hidden: yes

Active: no

Where can I find info to create a partition with the OEM type? Using the Extended and Logical partitions aren't going to work after all.

Link to comment
Share on other sites

How about this?

SELECT DISK 0
CLEAN
CREATE PART PRI SIZE=14096
SELECT PART 1
ASSIGN LETTER=D:
FORMAT FS=FAT32 QUICK
CREATE PART PRI SIZE=62220
ACTIVE
ASSIGN LETTER=C:
FORMAT FS=NTFS QUICK
EXIT

Post:

SELECT DISK 0
SELECT PART 1
ATTRIBUTES VOL SET HIDDEN
ATTRIBUTES VOL SET NODEFAULTDRIVELETTER
SET ID=27

Link to comment
Share on other sites

  • 1 month later...

OK thanks if I didn't say it before. I was able to faithfully recreate the recovery partition properly using imagex and diskpart. Now my situation is that I need to be able to boot into the recovery partition. It involves using a program called "MBRInst" by a company called XSS. I looked on the recovery program system builder CD that we are given but it does not have this program. It appears that the company is using a library that they interface from their application to write the bootcode into the MBR.

I've already talked to our rep and he basically said that the developers won't help anyone unless the corporate contract is over $1mil/year, which means we're not one of them.... And they would be the ones I could get this program from. But it also seems that this mbrinst.exe program is also used by HP and should be in their drive image. Is there a way someone could send me that program? PM me if interested or lock this thread if inappropriate.

Thanks.

Edited by Tripredacus
Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...