Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 

Sign in to follow this  

Winpe Boot, Diskpart, .bat Scripting

Recommended Posts

chekm8    0

Morning all,

Been lurking on and off on this forum and have gotten some great help, but can't seem to quite pinpoint my issue. A quick breakdown of what I have going. Have an unattended instal running for our W2K desktops using .BAT files. The process below has been proven and has ran without any issues and has had "0" user input other than to remove the CD from the drive (which I found here, can be automated)


1. CD running DOS boots

a. determines NIC and drops propper drivers

b. determines IP address and based on IP, maps propper server mapping

c. drops flag (small Ghost img) and reboots

d. after reboot, if flag (in 1c.) is found, asks for computer name which is save it to the .UDF on network

2. then runs Unattend.bat from network location

a. runs the W2K unattend.txt which formats and does it's thing

b. copies over the .UDF and names the box based on what's in the UDF

c. calls out APPS.BAT file that installs applications

3. Application install starts

So now we are moving to Windows XP. I've replaced the i386 files with that of WXP on my network share. I would like to have the same process as above work but ran into a drive formatting issue. XP doesn't build because the partition size is not large enough due to the fact that the "ExtendOemPartition=1" doesn't seem to work anymore under XP. I've tried to turn that switch off so that it prompts the user to format the drive and it works, but that defeats the purpose of having and unattended install. I would like that have that piece still automated.

So got a hold of WinPE 2004, tried the integrating DISKPART into old process but can't be run in DOS mode so it looks like I need to change step 1 to run from WinPE. Did some manual testing on VirtualPC and I can get WINBOM.INI to partition the drive and conver to NTFS. But when I run the UNATTEND.BAT on the network, I get "ACCESS DENIED". What am I doing wrong?

Is there any way to leave the process at the top alone and just utilize the DISKPART? It seems like using WINPE and WXP would be faster to build these boxes. Also, since WinPE should be the new standard, how do I tweak Process 1? I can probably eliminate Process 1a and 1c since WinPE takes care of that.

What do I need in WINBOM.INI to make it work so that it partitions the drive, maps to the proper server and runs the Unattend.bat?

Or, partition the drive, reboot the box, run through the process above (without 1a/1c)?

Using this code to partition the drive;


Disk1 = Disk1.config


WipeDisk = Yes

Size1 = *

PartitionType1 = Primary

SetActive1 = Yes

FileSystem1 = NTFS

QuickFormat1 = Yes

Thank you in advance for the help.

Share this post

Link to post
Share on other sites

ChrisBaksa    0

I saw some interesting comments in your post.

The extendOEMPartition switch does work under XP. Our desktop team uses it with every build. I also use it with Windows 2000 and 2003 Server installs.

You may want to change your logic. I found it best to create a FAT32 partition and let the install process convert it to NTFS on it's own. I found that when I created an NTFS partition using powerquests PQIDEPLOY, that the OS didn't like the format. So now I allow the setup to convert during install (it's an unattend switch) it gave me a fully supported File structure by Microsoft.

Don't forget.. after you create and format the partition, you have to MOUNT it to the PE OS as a drive letter so it can be written to.


Share this post

Link to post
Share on other sites
Noise    2

Wow, this is almost exactly how I setup my XP installation procedure for my company. I like the cut of your jib chekm8 :)

Here's how I do it.

Use the freeware GDISK.EXE to format your initial partition as fat16.

Instead of 1.C use the disks volume label. Use gdisk like this in DOS:



The above two lines will wipe any data from the hard disk, create a single/active 2GB FAT16 partition on the drive, and set the volume lable to something you can identify in your scripts after rebooting.

As for converting this 2GB FAT16 partition to NTFS? Make sure your unattend.txt has this in it and it will convert the small fat16 partition to a single huge ntfs partition (cut-and-pasted the two sections because I'm lazy).



Share this post

Link to post
Share on other sites
ChrisBaksa    0
You should install NTFS, not FAT32 with conversion. The end result isn't as efficient if you start with FAT32.

That depends on your application.

The tools I use do not Format NTFS properly. So Fat32 is what I use innitially.

This allow me to create a formatted 10 gig partition or up to a 500 Gig partition Very fast. The 10 gig partition takes less than 15 seconds.

Yes it extends the build time a but because of the conversion. But I accept it.

This is not an issue when I do imaging.


Share this post

Link to post
Share on other sites
chekm8    0

Sweet! Thanks for the great info guys!

I editted STARTNET.CMD and got it to work. I've managed to get PE to just format the drive completely in NTFS format, then mapped out my shared drive and kick off the unattend.txt. I bypassed Diskpart completely and it still worked.

format c: /fs:NTFS /q /Y

net use drive: \\server\share password /USER:domain\login

i:\i386\winnt32.exe /s:i:\i386 /unattend:i:\unattend.txt

Weird how Microsoft switched back to "/unattend" from "/u". Anyway, I got that to work so I can test out some builds. Now I just need to tweak a few things so I can map to the nearest server depending on the IP address. You guys are kool! :thumbup

Share this post

Link to post
Share on other sites
chekm8    0

shoot! forgot to add. I know I read it somewhere on this site I believe, but I'm having a problem after PE finishes the Prep. I have to manually close out of PE for XP to start it's build. Tried the "exit" command in STARTNET.COMD and it seems to just hang. Any suggestions? TIA.

Share this post

Link to post
Share on other sites
getwired    0

Two things:

1: also add /makelocalsource /tempdrive:C: /syspart:C: to your winnt32 command to ensure it works properly.

2: Adding EXIT as the last command in startnet.cmd (right after winnt32) should just work, as it will exit the cmdprompt and cause a reboot. That's not working for you?

Share this post

Link to post
Share on other sites
duomenox    0

If you want to format FAT32 and optimize it for conversion to NTFS copy oformat.com and cvtarea.exe from the WinXP Deployment Kit (or the Server 2003 Deployment kit) to your WinPE disc.

(The deployment kit can be found on the XP or 2003 CD as deploy.cab under CDROOT\Support\Tools)

Add the following lines to your boot process,

oformat c: /a:8 /v:"(Volume Name)" /q

cvtarea c:\cvtarea.tmp 1024 MB /contig /firstcluster 3 gb

That was assuming you have a drive that is 10GB or larger.

To convert from FAT32 to NTFS use the following command

convert c: /fs:ntfs /cvtarea:cvtarea.tmp

If you format your drives using this procedure and use cvtarea.exe to create a place holder for the NTFS MFT files your coverted NTFS partition will be almost as effiecient as a native NTFS format.

We use this procedure because Ghost Corp 8.0 cannot write to an NTFS partition in a ghost image.... so we keep all our images FAT32 and convert to NTFS during the configuration process.

One last thing,

If you convert your system drive to NTFS while in windows and want to script the converstion process you will need to use the following line

cmd.exe /C "echo y | convert c: /x /fs:ntfs /cvtarea:cvtarea.tmp"

This will bypass the request to force a dismount, then supply a yes answer to the "would you like to convert during the next reboot" question... the cmd /c will close the command window opened to run the command directly after the command finishes.

Use this method if you have a practical need to have your partiitons FAT32 (like for read/write use in ghost).

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  

  • Recently Browsing   0 members

    No registered users viewing this page.