Newman57
Sep 10 2007, 03:51 AM
Hoping someone can help me out.
I'm trying to install WindowsXP 64 bit unattended using WindowsPE and want to partition the HD with 1 partition with 30GB and the rest of the disk with the remaining space.
The trouble I'm having is that the computers vary in configuration. Some have a card reader which WindowsPE sees as a disk (or at least DISKPART does).
The disk number varies so I'd like to use a script which reads the first available online disk (some of the computers have 2 disks) and remove all existing partitions and create a 30GB partition and a second one with the remaining space.
Does anyone know how to do this?
Thanks in advance.
hj_fr
Sep 11 2007, 01:30 AM
yes easy:
Launch:
diskpart /s diskpart.scriptand in your diskpart.script something like:
CODE
select disk 0
clean
create partition primary size=30000
active
assign letter=c
create partition primary
assign letter=d
exit
mallen
Sep 11 2007, 01:48 AM
I see where you're coming from - I had a similar problem when I wanted to use diskpart to change the drive letter of the CDROM drive. I couldn't guarantee which volume it would be. In the end I put together a short VBS script. Use a script to identify which drive it is you want to change. Remember you can use drive letters when specifying the volume in diskpart. With the same vbs script, write out a diskpart.txt script that is specific to that machine, then use the method mentioned above to call it.
Here is how I managed to get this working for a cdrom:
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set CDRoms = FileSystemObject.Drives
Set wshShell = WScript.CreateObject ("WScript.shell")
Dim DVDDriveLetter
For Each CDDrive in CDRoms
If CDDrive.drivetype = "4" Then
DVDDriveLetter = CDDrive.driveletter
End If
Next
Set objTextStream = FileSystemObject.OpenTextFile("C:\diskpart.txt", 2, True)
objTextStream.WriteLine "SELECT VOLUME " & DVDDriveLetter
objTextStream.WriteLine "ASSIGN LETTER=Z"
objTextStream.WriteLine "EXIT"
objTextStream.Close
Set CDRoms = nothing
Set FileSystemObject = nothing
set wshshell = nothing
You could use a similar method to check for a file you know is on the disk you want to change.
Newman57
Sep 11 2007, 03:54 AM
Thanks mallen,
You've been most helpfull.