none
Inconsistent disk mapping after Windows PE boot from DVD causing imagex to apply WES7 image to wrong disk RRS feed

  • Question

  • I've built a Windows PE environment that will automatically run diskpart to format disk 0, partition 1, and run imagex to apply my image to the C: drive. My system has two physical disks. Sometimes the Windows PE environment will assign disk 0 to the first physical disk and sometimes it will assign disk 0 to the second physical disk. When disk 0 is assigned to the second physical disk the WES7 image is applied to the wrong disk and the system won't boot.

    Any tips on how I can get my Windows PE environment to always select the same physical disk?

    More detail: I'm assuming in my script that the two disks are already partitioned. The first physical disk should have drive C and E, while the second physical disk should have drive D. The Windows image already has the correct letter assignment. Sometimes Windows PE and diskpart will select the D drive as disk 0. We are using this image to upgrade Windows XP to WES7 in the field.

    Alternatively, assume I didn't care which physical disk was previously the boot disk. How can I tell my system (BIOS?) to boot from a particular physical drive?

    Thanks.

    Monday, July 11, 2016 4:44 PM

All replies

  • 1. Are the disks the same make an model and size? If not, you should be able to tell them apart in the BIOS and set the boot order.

    2. If the sizes are different maybe the script could detect the size and install to the correct drive?

    3. Are you using WinPE and imagex to deploy the image? Could some other deployment solution work like clonezilla, Acronis, etc.?


    Sean Liming - Book Author: Starter Guide SIM (WEI), Pro Guide to WE8S & WES 7, Pro Guide to POS for .NET - www.annabooks.com / www.seanliming.com

    Tuesday, July 12, 2016 1:28 AM
    Moderator
  • Thank you for your reply. The hard disks are the same make, model, and size. Yes I think clonezilla or Acronis will do just fine.

    Since the image will only ever be used to upgrade from Windows XP, I've modified it to use the output of bcdedit to determine the current bootable device as follows:

    bcdedit | find "device" > command.tmp
    for /F "tokens=3 delims== " %%i in (command.tmp) do (set device=%%i)
    del command.tmp
    if not exist %device% goto error 

    Edit: Nevermind, that didn't work either. When the wrong disk is selected bcdedit doesn't work either. I modified the script to output the list of volumes provided by diskpart 'list volume' and prompt the service technician to decide where to put the image.


    • Edited by Brian Heilig Tuesday, July 12, 2016 3:20 PM First solution didn't work
    Tuesday, July 12, 2016 1:22 PM
  • I think the most powerful way to distinguish between disk is to use PowerShell. It has cmdlets which can help in maintaining disks and partitions.

    It can be used in Windows PE starting from version 5.0 (you'll have to build your own image). With PowerShell you could easily obtain partitions sizes and select the appropriate one.

    Thursday, July 14, 2016 12:36 PM
  • when you use diskpart, use it with a script that does something like this:

    eg: diskpart.txt contains:

    -------8<--------------------------------------------------------

    rem
    select disk 0
    clean
    rem ----------------------------------- 1 System
    create part pri size=350
    format quick fs=ntfs label="System"
    assign letter="S"
    active
    rem ----------------------------------- 2 OS
    create part pri size=32000
    format quick fs=ntfs label="Windows"
    assign letter="W"
    rem ----------------------------------- 3 Data
    create part pri
    format quick fs=ntfs label="Data"
    assign letter=Z
    rem -----------------------------------
    list volume
    exit

    ------>8---------------------------------------------------------

    diskpart /s diskpart.txt

    Now your new partitions have known letters and you can dism/imagex whatever.

    As long as you aren't in UEFI hell, when you reboot, they get C and D.

    (Above example is one I use every day. Although I do everything with USB, not DVD due to the image bloat.)


    =^x^=

    Thursday, July 28, 2016 7:20 AM