September 10, 200718 yr 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.
September 11, 200718 yr yes easy:Launch: diskpart /s diskpart.scriptand in your diskpart.script something like:select disk 0cleancreate partition primary size=30000activeassign letter=ccreate partition primaryassign letter=dexit Edited September 11, 200718 yr by hj_fr
September 11, 200718 yr 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.DrivesSet wshShell = WScript.CreateObject ("WScript.shell")Dim DVDDriveLetterFor Each CDDrive in CDRoms If CDDrive.drivetype = "4" Then DVDDriveLetter = CDDrive.driveletter End IfNextSet objTextStream = FileSystemObject.OpenTextFile("C:\diskpart.txt", 2, True)objTextStream.WriteLine "SELECT VOLUME " & DVDDriveLetterobjTextStream.WriteLine "ASSIGN LETTER=Z"objTextStream.WriteLine "EXIT"objTextStream.CloseSet CDRoms = nothingSet FileSystemObject = nothingset wshshell = nothingYou could use a similar method to check for a file you know is on the disk you want to change. Edited September 11, 200718 yr by mallen
October 23, 201114 yr I do something for my vmware builds to make sure the alignment is correctI found part of this online but added some of the stuff I was already doing to it.The volume labels you can change this does up to 4 drives and changes the cdrom drive to z:@echo offrem Create and Format partition(s)rem first assign the cdrom drive to z::CDROMrem Create Diskpart Scriptecho select disk 0 >"c:\source\scripts\part.txt"echo select volume d >>"c:\source\scripts\part.txt"echo assign letter Z noerr >>"c:\source\scripts\part.txt"rem change cdrom drive letter PartitionDiskPart /s "c:\source\scripts\part.txt":DDRIVEecho select disk 1 > "c:\source\scripts\part.txt"echo create partition primary align=64 >>"c:\source\scripts\part.txt"echo assign letter=D >>"c:\source\scripts\part.txt"echo active >>"c:\source\scripts\part.txt"rem Create PartitionDiskPart /s "c:\source\scripts\part.txt"format D: /FS:NTFS /V:ddrive /q /A:32K /y:EDRIVEecho select disk 2 >"c:\source\scripts\part.txt" echo create partition primary align=64 >>"c:\source\scripts\part.txt"echo assign letter=E >>"c:\source\scripts\part.txt"echo active >>"c:\source\scripts\part.txt" Rem creating partitionDiskPart /s "c:\source\scripts\part.txt"rem Format Partitionformat E: /FS:NTFS /V:edrive /q /A:32K /y:FDRIVEecho select disk 3 >"c:\source\scripts\part.txt" echo create partition primary align=64>>"c:\source\scripts\part.txt"echo assign letter=F >>"c:\source\scripts\part.txt"echo active >>"c:\source\scripts\part.txt" rem Create PartitionDiskPart /s "c:\source\scripts\part.txt"rem Format Partitionformat F: /FS:NTFS /V:fdrive /q /A:32K /y:Errorrem Return ACCESS DENIEDset ERRORLEVEL=5:EXIT
Create an account or sign in to comment