diskpart script hangs at "select disk"


  1. Posts : 2
    Windows 7 64bit
       #1

    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 Computer


  2. Posts : 12
    Windows 7 Professional 64bit
       #2

    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 Computer


  3. Posts : 2
    Windows 7 64bit
    Thread Starter
       #3

    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 Computer


 

  Related Discussions
Our Sites
Site Links
About Us
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
All times are GMT -5. The time now is 01:42.
Find Us