MSFN Forum: Diskpart scripting question - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Diskpart scripting question Please review for errors Rate Topic: -----

#1 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 6,988
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 26 March 2008 - 09:20 AM

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



#2 User is offline   dim 

  • Newbie
  • Group: Members
  • Posts: 45
  • Joined: 07-August 06

Posted 26 March 2008 - 04:08 PM

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.

#3 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 6,988
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 27 March 2008 - 01:53 PM

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.

#4 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 6,988
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 28 March 2008 - 11:09 AM

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 [size=n] [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.

#5 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 6,988
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 28 March 2008 - 12:08 PM

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/...on-t103807.html

#6 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 6,988
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 04 April 2008 - 09:07 AM

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.

#7 User is offline   TheReasonIFail 

  • Member
  • PipPip
  • Group: Members
  • Posts: 170
  • Joined: 08-April 07

Posted 04 April 2008 - 06:50 PM

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


#8 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 6,988
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 14 May 2008 - 02:43 PM

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.

This post has been edited by Tripredacus: 14 May 2008 - 02:43 PM


#9 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 6,988
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 19 May 2008 - 02:48 PM

**post removed

This post has been edited by Tripredacus: 20 May 2008 - 02:21 PM


#10 User is offline   TheReasonIFail 

  • Member
  • PipPip
  • Group: Members
  • Posts: 170
  • Joined: 08-April 07

Posted 19 May 2008 - 03:34 PM

Thanks for the link, I'll be playing with this all this week!

#11 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 6,988
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 20 May 2008 - 01:57 PM

**post removed

This post has been edited by Tripredacus: 20 May 2008 - 02:11 PM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy