Windows 7 Forums


Windows 7: diskpart script hangs at "select disk"

03 Oct 2012   #1

Windows 7 64bit
 
 
diskpart script hangs at "select disk"

Hi. most of the machines I deploy have two disks. I am using a diskpart script to clean and format the disks/partitions. Well, I need to be able to deploy onto a machine that only has one disk. Since the "select" command doesn't have the "noerr" option the script fails on the single disk machine. Is there a way I can modify the script so that it will work on both configurations? Here is my simple script:

select volume 0
remove noerr
select disk 1
clean
select disk 0
clean
select disk 1
create partition primary
select partition 1
format FS=NTFS label=Voyager-1.0 quick
active
assign letter=c
select disk 0
create partition primary
select partition 1
format fs=ntfs label=DATA quick
assign letter=d
exit

Thanks in advance,
Rob

My System SpecsSystem Spec

03 Oct 2012   #2

Windows 7 Professional 64bit
 
 

Am I right to assume that you are trying to partition a single disk into 2 partitions? And for this single hd machine, are you running diskpart from a bootable media?
My System SpecsSystem Spec
03 Oct 2012   #3

Windows 7 64bit
 
 

Thanks for the quick reply. To answer your question...
The script I posted basically partitions two disks with one partition each. The first disk is the system drive (c) and the second disk is a data drive.

On the laptop there will only be one disk and it needs to be a single partiton (c).

The problem is when my script tries to select the second disk and there isn't one on the laptop the script will hang. If I could use "noerr" on the select command I think it would be fine. I am PXE booting into winpe and the script is being called from the bootstrap.ini file. I think there needs to be some logic in the script that detects the number of disks first, but unfortunately I'm not a very good scripter and am not sure how to approach it. I was hoping there was a simple way to add the logic into the batch file posted rather than try and write a .vbs script. I'm decent with powershell but winpe doesn't have it and adding it is an extra step in addition to writing the actual script. I hope this makes sense. Thanks again.
My System SpecsSystem Spec
.


Reply

 diskpart script hangs at "select disk" problems?



Thread Tools



Similar help and support threads for: diskpart script hangs at "select disk"
Thread Forum
Assigning "domain user" to "local admin" on select PCs Network & Sharing
Can "diskpart clean all" be performed after a "diskpart clean" ? Hardware & Devices
Solved diskpart's "clean all" hangs, no signs of HD activity Performance & Maintenance
"Select Proper Boot Device" now "NTLDR is missing" BSOD Help and Support
Disk Management hangs at "Loading disk configuration information" Performance & Maintenance


All times are GMT -5. The time now is 09:51 AM.


Seven Forums Android App Seven Forums IOS App Follow us on Facebook

Windows 7 Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32