Diskpart a Drive to Create 4 Partitions

email me

What does this allow me to do?

I can have a system partition, data partition, and a recovery partition…plus a hidden partition reserved for the system. Adding this to your startnet.cmd file will automate the partitioning; and as you can see with imagex.exe, it will restore the Recovery partition, and then restore the System partition. Basically, this is an automated script to rebuild a machine with multiple partitions. My particular WIM file also creates a Refresh option on the boot menu, which will allow users to automatically refresh their System partition without affecting their Data partition.

To be added to startnet.cmd in your boot.wim
———————————————-

if exist c:\recovery.wim set MyDrv=c
if exist d:\recovery.wim set MyDrv=d
if exist e:\recovery.wim set MyDrv=e
if exist f:\recovery.wim set MyDrv=f
if exist g:\recovery.wim set MyDrv=g
if exist h:\recovery.wim set MyDrv=h
if exist i:\recovery.wim set MyDrv=i
if exist j:\recovery.wim set MyDrv=j
if exist k:\recovery.wim set MyDrv=k
if exist l:\recovery.wim set MyDrv=l

diskpart /s %MyDrv%:\diskpart.txt
%MyDrv%:\imagex /apply %MyDrv%:\recovery.wim 1 n:\
%MyDrv%:\imagex /apply n:\boot\wim\image.wim 1 m:\

bcdboot m:\windows /s s: 
bootsect /nt60 s:

 

the diskpart.txt file
———————————————-
Select disk 0
Clean
Create partition primary size=100
Select partition 1
Format fs=ntfs label=”System Reserved” quick
assign letter=s

Create partition primary size=100000
select partition 2
Format fs=ntfs quick
assign letter=m

Create partition primary size=49000
select partition 3
Format fs=ntfs label=”Recovery” quick
assign letter=n

Create partition extended
select partition 0
Create partition logical size=100000
select partition 4
Format fs=ntfs label=”Data” quick

Select partition 1
active
exit
———————————————-