Jump to content
DeployCentral

2 partitions


dewin

Recommended Posts

Hello Dewin,

There are a couple of ways to accomplish this. The easiest is to setup the virtual reference machine with the same partitioning that you would like on the target machine. For example if you are installing Windows XP and would like to have a second partition for data you can create your VM in this manner and then capture the image. The other option would be to use a pre-image task to run a script to automate the creation of the 2nd partition.To run a task you simply boot the target machine to SmartPE, then select advanced from the Deployment Wizard. From here you will see the tasks tab which allows you to call the script and select a phase of deployment for it to run.

Below is an example VBScript that will create a two partition drive, the first partition will be 80GB and the second will be the remainder of the drive. You will need to make the script available in the boot media by using Media Wizard. Then you will need to create a task to run the script in the pre-image phase. Also be sure to select Wipe & Load drives in the Deploy Wizard or the entire disk will be cleaned and re-partitioned.

OPTION EXPLICIT

Dim oShell, Instance, oExec, intPhysicalDiskSize : intPhysicalDiskSize = 0
Dim blnFormatD : blnFormatD = True
Set oShell = CreateObject("WScript.Shell")
For Each Instance In GetObject("winmgmts:\\.\root\cimv2").ExecQuery("SELECT * FROM Win32_DiskDrive WHERE DeviceID = '\\\\.\\PHYSICALDRIVE0'")
	intPhysicalDiskSize = Instance.Size
Next
If intPhysicalDiskSize > 1 Then
	Set oExec = oShell.Exec("diskpart.exe")
	oExec.StdIn.WriteLine "select disk 0"
	oExec.StdIn.WriteLine "clean"
	oExec.StdIn.WriteLine "create partition primary size=80000"
	oExec.StdIn.WriteLine "select partition 1"
	oExec.StdIn.WriteLine "active"
	oExec.StdIn.WriteLine "assign letter=c"
	oExec.StdIn.WriteLine "create partition primary"
	oExec.StdIn.WriteLine "assign letter=w"
	oExec.StdIn.WriteLine "exit"
	Do While Not oExec.StdOut.AtEndOfStream
		If InStr(oExec.StdOut.ReadLine, "could not assign") Then blnFormatD = False
	Loop
	Set oExec = Nothing
	oShell.Run "cmd.exe /c format c: /fs:ntfs /q /y", 0, True
	If blnFormatD Then oShell.Run "cmd.exe /c format w: /fs:ntfs /q /y", 0, True
End If
Set oShell = Nothing

Thanks,

Erik

Link to comment
Share on other sites

  • 2 years later...
  • 2 years later...
So I found another solution:
1. Create a text file and name it 2Partitions.txt
2. Paste the following commands and save it
list disk
select disk 0
clean
create partition primary size=100000
select partition 1
format quick fs=ntfs label="OSDisk"
assign letter=C
active
create partition primary
select partition 2
format quick fs=ntfs label="DATA"
assign letter=D
list vol
exit
Please note:
Create a text file and name it 2Partitions.txt --> You can name the file to whatever you like
Create partition primary size=100000 --> This line will create the first partition of size 100GB. You can change the size to whatever you wish as long as the hard drive can handle
Create partition primary --> This line will create the second partition using the rest or remaining space on the drive
3. Now, how to run this script in Windows PE environment. Follow the steps bellow.
4. Boot to SmartDeploy media.
5. Click the link at the bottom of the Welcome screen to launch a Windows PE command prompt.
6. At the prompt key in:diskpart /s 2Psartitions.txt
7. In my case it will look like this: X:\Windows\System32>diskpart /s E:\Script\2Partitions.txt.
8. All the diskpart commands output will display on the screen
8. E drive is the bootable SmartDeploy Media
Hope this will help...
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
×
×
  • Create New...