Jump to content

Automatic Partitioning for unattended installs


Recommended Posts

Ok that all makes sense when I think about what winpe, the opk and sysprep are intended to be used for and it also makes me think that since we're not sysprep'ing that the oemrunonce isn't going to do what we want. So we're now trying to use the [GuiRunOnce] section in the winnt.sif and I'll post results once we test that. I'm also thinking that further problems should probably be posted in the winpe forum now. Thanks for all your help so far JuMz.

Edited by rsbennett00
Link to comment
Share on other sites


We got it!

Hit the spacebar to boot to the dvd and it loads PE. Startnet takes off and asks if you want advanced options or the default. Hit advanced and it asks if you want to change the partitioning of the HD0 or just format your existing C: drive. Choose repartitioning and it asks how big you want the C: drive. The default option (most used in our environment) is repartition C: to 25gb and the rest to D:. From there it takes care of whatever choices you made, then copies needed files to the C: drive and kicks off the XP install. After XP finishes, then the rest of the auto-installs run and about 45 minutes later you have the following done:

Installed Windows XP Pro with all possible updates (as of this date) into C:\windows

Installed the entity specific Fonts

Installed Adobe Acrobat Reader 7.08

Installed Lotus Notes 7 client

Installed Firefox 1.5

Installed MS Office 2003

Installed Sophos 5.12

Installed Java Runtime 5.07

Installed MS .net 1 with SP1

Installed MS .net 2

Update some drivers, stick it on the domain, copy in the notes id file, update Sophos and it's ready to be deployed to the end user. This is so simple we're really not going to need ghost anymore.

Thanks for all your help.

Link to comment
Share on other sites

We got it!

Hit the spacebar to boot to the dvd and it loads PE. Startnet takes off and asks if you want advanced options or the default. Hit advanced and it asks if you want to change the partitioning of the HD0 or just format your existing C: drive. Choose repartitioning and it asks how big you want the C: drive. The default option (most used in our environment) is repartition C: to 25gb and the rest to D:. From there it takes care of whatever choices you made,...

What scripts / interface are you using to do all this? Sounds interesting, right now, my install doesn't have any custom options like this...startnet goes, factory -winpe, then XP installs, based on the same unattend.txt for all my machines...

Link to comment
Share on other sites

Here's my startnet.bat. This pretty much covers everything, you can imagine what my diskpart scripts do from here.

@ECHO OFF
factory -winpe

@echo
diskpart /s x:\listpart1.txt

set def=
set /p def=Press 1 for advanced options or 2 for the defaults. (Press C to cancel)
if '%def%'=='1' goto advanced
if '%def%'=='2' goto install
if '%def%'=='c' goto cancel

rem choice /c:12 /t:2,30 Press 1 for advanced options or 2 for the defaults. You have 30 seconds to comply.
rem if errorlevel 2 goto size25
rem if errorlevel 1 goto advanced


:advanced
ECHO WARNING! Data loss is imminent.
set adv=
diskpart /s x:\listpart1.txt
set /p adv=Would you like to repartition the primary Hard Drive? (Press C to cancel)
if '%adv%'=='c' goto cancel
if '%adv%'=='y' goto size
if '%adv%'=='n' goto install

:cancel
ECHO You have cancelled this script.
pause
exit

:size
ECHO WARNING WARNING WARNING
ECHO This script is about to wipe out the first Hard Drive in this system. It is HIGHLY recommended any secondary
ECHO Hard Drives be disconnected during this process.
ECHO CTRL-C now and terminate this program to prevent data loss.
diskpart /s x:\listdisk0.txt
ECHO Please choose from the following sizes for C:, 20, 25, 30, 35, 40, 50 GB or max.
set sizec=
set sized=
set /p sizec=Define the size you would like the C: partition in gigabytes. Use max for maximum.
goto whatsize

:whatsize
if '%sizec%'=='max' goto maxc
if '%sizec%'=='20' goto sizec20
if '%sizec%'=='25' goto sizec25
if '%sizec%'=='30' goto sizec30
if '%sizec%'=='35' goto sizec35
if '%sizec%'=='40' goto sizec40
if '%sizec%'=='50' goto sizec50
goto nosize

:nosize
ECHO Sorry, the size you chose for C: is not an option, please choose 20, 25, 30, 35, 40, 50 GB or max.
goto size

:maxc
diskpart /s x:\maxc.txt
goto install

:sizec20
diskpart /s x:\disk20.txt
goto dpart

:sizec25
diskpart /s x:\disk25.txt
goto dpart

:sizec30
diskpart /s x:\disk30.txt
goto dpart

:sizec35
diskpart /s x:\disk35.txt
goto dpart

:sizec40
diskpart /s x:\disk40.txt
goto dpart

:sizec50
diskpart /s x:\disk50.txt
goto dpart

:dpart
diskpart /s x:\maxd.txt
goto install

:install
echo y|format c: /fs:ntfs /q >nul
md c:\install
md c:\distro
xcopy x:\install\*.* c:\install /e /y
xcopy x:\distro\*.* c:\distro /e /y
cd\xppro\i386
winnt32 /syspart:c: /dudisable /makelocalsource /s:x:\xppro\i386 /unattend:x:\xppro\i386\winnt.sif
exit

Link to comment
Share on other sites

I don't quite understand this part of the script:

set def=

set /p def=Press 1 for advanced options or 2 for the defaults. (Press C to cancel)

if '%def%'=='1' goto advanced

if '%def%'=='2' goto install

if '%def%'=='c' goto cancel

If the user chooses 2, then the script goes to the install section directly?

Link to comment
Share on other sites

Woops, that was a test copy while we were trying to get the choice command working, which we did this morning. Here's our perfected startnet.cmd.

@ECHO OFF
factory -winpe

@echo
diskpart /s x:\listpart1.txt
choice /c:12 /n /t:2,20 Press 1 for advanced options or 2 for defaults. You have 20 seconds to comply.
if errorlevel 2 goto sizec25
if errorlevel 1 goto advanced


:advanced
ECHO WARNING! Data loss is imminent.
set adv=
diskpart /s x:\listpart1.txt
set /p adv=Would you like to repartition the primary Hard Drive? (Press C to cancel)
if '%adv%'=='c' goto cancel
if '%adv%'=='y' goto size
if '%adv%'=='n' goto install

:cancel
ECHO You have cancelled this script.
pause
exit

:size
ECHO WARNING WARNING WARNING
ECHO This disk is about to wipe out the first Hard Drive in this system. It is HIGHLY recommended any secondary
ECHO Hard Drives be disconnected during this process.
ECHO CTRL-C now and terminate this program to prevent data loss.
diskpart /s x:\listdisk0.txt
ECHO Please choose from the following sizes for C:, 20, 25, 30, 35, 40 or 50 GB.
set sizec=
set sized=
set /p sizec=Define the size you would like the C: partition in gigabytes. Use max for maximum.
goto whatsize

:whatsize
if '%sizec%'=='max' goto maxc
if '%sizec%'=='20' goto sizec20
if '%sizec%'=='25' goto sizec25
if '%sizec%'=='30' goto sizec30
if '%sizec%'=='35' goto sizec35
if '%sizec%'=='40' goto sizec40
if '%sizec%'=='50' goto sizec50
goto nosize

:nosize
ECHO Sorry, the size you chose for C: is not an option, please choose 20, 25, 30, 35, 40 or 50 GB.
goto size

:maxc
diskpart /s x:\maxc.txt
goto install

:sizec20
diskpart /s x:\disk20.txt
goto dpart

:sizec25
diskpart /s x:\disk25.txt
goto dpart

:sizec30
diskpart /s x:\disk30.txt
goto dpart

:sizec35
diskpart /s x:\disk35.txt
goto dpart

:sizec40
diskpart /s x:\disk40.txt
goto dpart

:sizec50
diskpart /s x:\disk50.txt
goto dpart

:dpart
diskpart /s x:\maxd.txt
goto install

:install
echo y|format c: /fs:ntfs /q >nul
md c:\install
md C:\distro
xcopy x:\install\*.* c:\install /e /y
xcopy x:\distro\*.* c:\distro /e /y
cd\xppro\i386
winnt32 /syspart:c: /dudisable /makelocalsource /s:x:\xppro\i386 /unattend:x:\xppro\i386\winnt.sif
exit

Link to comment
Share on other sites

Many thanks for the updated script.

Have you considered, rather than having a selection of sizes, how about allowing for a custom specified size on the spot, if that's possible to do (write to a temp diskpart.txt)? Just wondering...

Link to comment
Share on other sites

Have you tried Terabyte? I've been using for 2 years now and it has operated flawlessly.

http://www.terabyteunlimited.com/

Which product and to do what?

BootItNg to do any and all your partitioning/multi-boot chores, Image for DOS/Image for Windows to do any and all backup, image, diskcopy etc. Terabyte also has a BartPe plugin to work on the bootable disc. BING is fully customizable; ie: custom scripts etc. Email the author for more indepth at Terabyte's website; inexpensive but, powerful and accurate; well worth checking out anyways.

Link to comment
Share on other sites

Many thanks for the updated script.

Have you considered, rather than having a selection of sizes, how about allowing for a custom specified size on the spot, if that's possible to do (write to a temp diskpart.txt)? Just wondering...

Hmm, is that possible? Just off the top of my head something like...

set cpartsize=
set /p cpartsize=Type a size for the C: Partition in megabytes.
diskpart /s x:\disk0.txt

Then disk0.txt would look something like this?

select disk 0
clean
create partition primary size=%cpartsize%
select partition 1
active
assign letter=c
create partition primary

Would that work? I may have to try it next week when I get some free time.

Link to comment
Share on other sites

Looks promising, thanks. I think it would work. Awaiting your testing...or when I get round to doing it...

I can't seem to find a way for diskpart to use variables. So now I'm trying to create a ramdrive and use the copy command to create the diskpart script file. Will post after further testing.

Link to comment
Share on other sites

Since I can't figure out how to get diskpart to use variables I had to add a ramdrive to the script and change startnet accordingly. Here's my new startnet:

@ECHO OFF
factory -winpe

@echo
@echo
@echo
@echo !!WARNING!! This script will wipe out data on the primary Hard Drive. !!WARNING!!
@echo .
@echo .
diskpart /s x:\listpart1.txt
@echo .
choice /c:123 /n /t:3,5 Press 1 for advanced options or 2 for defaults. You have 20 seconds to comply.
if errorlevel 3 goto 15secs
if errorlevel 2 goto default
if errorlevel 1 goto advanced

:15secs
@echo
@echo
choice /c:123 /n /t:3,10 Press 1 for advanced options or 2 for defaults. You have 15 seconds to comply.
if errorlevel 3 goto 5secs
if errorlevel 2 goto default
if errorlevel 1 goto advanced

:5secs
@echo
@echo
choice /c:12 /n /t:2,5 Press 1 for advanced options or 2 for defaults. You have 5 seconds to comply.
if errorlevel 2 goto default
if errorlevel 1 goto advanced


:advanced
ECHO WARNING! Data loss is imminent.
set adv=
diskpart /s x:\listpart1.txt
@echo .
set /p adv=Would you like to repartition the primary Hard Drive? (Press C to cancel)
if '%adv%'=='c' goto cancel
if '%adv%'=='y' goto size
if '%adv%'=='n' goto install
@echo Invalid choice.
goto advanced

:default
diskpart /s x:\default.txt
goto install

:cancel
ECHO You have cancelled this script.
pause
exit

:size
set cpartsize=
set /p cpartsize=Type a size for the C: Partition in gigabytes. (Press C to cancel)
if '%cpartsize%'=='c' goto cancel
@echo create partition primary size=%cpartsize%000>z:\disk0_2.txt
copy x:\disk0_1.txt+z:\disk0_2.txt+x:\disk0_3.txt z:\disk0.txt >nul
diskpart /s z:\disk0.txt
goto install


:install
echo y|format c: /fs:ntfs /q >nul
md c:\install
md C:\distro
xcopy x:\install\*.* c:\install /e /y
xcopy x:\distro\*.* c:\distro /e /y
cd\xppro\i386
winnt32 /syspart:c: /dudisable /makelocalsource /s:x:\xppro\i386 /unattend:x:\xppro\i386\winnt.sif
exit

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