none
eMMC controller breaks my Diskpart script RRS feed

  • Question

  • I'm using a simple Win10v1809x64 PE with a simple batch script that executes at the PE's boot time and invokes a diskpart script that selects and cleans disk 0, then dumps an image onto it.


    With every SATA, NVME controller based system I've encountered until now, this is perfectly fine.  All system boards enumerate devices on these storage controllers the same way; as DISK 0, BEFORE the USB key I just booted from which gets DISK 1.

    I now have a system that has an eMMC controller.  Unfortunately, the system enumerates this device AFTER the USB key I just booted from.  In other words, DISK 0 is the USB key and the eMMC disk becomes DISK 1.

    The script happily erases disk 0... which is the booting USB key.

    I'm looking for a solution that will decide which disk (0 or 1) gets CLEANed by detecting... something.  The script can be .cmd or .bat or I guess .ps1 since it's in a PE.

    Any takers?

    My current diskpart script for creating a LEGACY booting drive.

    rem == Create-LEGACY.txt ==
    rem == DiskPart script to prepare a disk for a LEGACY/MBR-based PC.
    
    select disk 0
    clean
    
    rem == 1. System partition
    create partition primary size=500
    format quick fs=ntfs label="System Reserved"
    assign letter="S"
    active
    
    rem == 2a. Windows partition
    create partition primary
    
    rem == 2b. <OPTIONAL> Shrink Windows Partition to match space needed for recovery tools (winre.wim)
    rem shrink minimum=1024
    
    rem == 2c. Windows partition
    format quick fs=ntfs label="%RECIPE%"
    assign letter="W"
    
    rem == 3. <OPTIONAL> Recovery tools partition
    rem create partition primary
    rem format quick fs=ntfs label="Recovery"
    rem assign letter="R"
    rem set id=27
    
    list volume
    exit


    This is invoked by .cmd with the line:

    diskpart /s "X:\Create-Legacy.txt"
    

    • Edited by Ericahalfbee Thursday, March 21, 2019 8:48 PM
    • Moved by Bill_Stewart Wednesday, September 4, 2019 7:16 PM Off-topic
    Thursday, March 21, 2019 8:43 PM

All replies

  • This is an issue for a hardware or PE forum.  DISKPART is a utility and not a script.  This forum is for admin scripting using a script system like VBScript or PowerShell.  Your issue is about how to use a utility with a particular vendors disk.

    You can also consider running dispkpart after the PE system is completely booted or use MDT to set this up.

    I suggest posting in the MDT from to learn how to make a bootable PE system that will do this at the best time for the system.'


    \_(ツ)_/

    Thursday, March 21, 2019 9:25 PM

  • Invoking the script later has no effect on enumeration of the controllers, this is a BIOS hand-off to Windows thing.

    I am looking for a powershell solution if one exists.  Perhaps parse the output of diskpart list disk to except the USB as a possible drive to target for cleaning, then insert that as a variable into the diskpart script to `select disk %variable%' to clean.

    Right now I'm going to throw a manual diskpart list script and let the tech explicitly select the disk to clean from the results output.



    Friday, March 22, 2019 3:38 PM
  • There is no PowerShell solution.  If the BIOS does not make a new USB device available thn the device cannot be seen by PowerShell.

    'diskpart" calls the low-level API.  If the device is not registered in the BIOS and recognized by the boot scan then it cannot be accessed. 

    You can try "devcon" to see if it can enumerate the device as it can see devices that are not recognized as disks because they are not detectable by the system.

    Your best bet is to post both in the MDT forum and the vendors forums.  The vendor may know why their device doesn't register.  Some devices require a specific USB support driver to be installed.  Including this in the PE image may allow the device and other devices like it to be detected.

    Also be sure you are using an up-to-date PE image.

    You can also install WMI support into PE and use that to inspect the system as WMI can see many low level, uninitiated devices.


    \_(ツ)_/

    Friday, March 22, 2019 4:02 PM

  • You misunderstand.  It IS registering.  It IS detected.  It is assigned a disk # and drive letter.

    The problem is that the eMMC (embedded Multi-Media Controller) is being enumerated after the standard boot devices and after the USB controller because of the nature of the eMMC controller ... think of it as a bootable card reader.  So using select disk 0, which in 99.99%% of situations perfectly identifies the first storage device connected to SATA or NVMe or PCIe-NVMe, in this case will select the USB key because it is enumerated as a disk BEFORE the eMMC is.  It doesn't mean it stops at the USB, it's just that the eMMC comes after.

    This is a first for our environment, but will likely occur more often as more devices use eMMC as a cost-cutting measure.  I can set up a manual method that forces the tech to choose which disk to clean, but I'm looking for an automated external script that could be used to enumerate the disks as diskpart would see it.  It would then eliminate the USB boot drive's disk #, and choose the only other choice.  Save that number (0 or 1) as a variable that I can then access by including it in the diskpart script. eg: select disk %variable%



    Friday, March 22, 2019 4:32 PM
  • If it is not being installed by the boot process then there is something missing in the system image.  The vendor is likely the only one who can tell you what you are missing. 

    The OS is clearly not detecting the device as a disk.  A controller for multiple device types cannot be seen by "diskpart" if ther is no "disk"or card  in the controller.  If the eMMC control is connected to the USB, as most newer ones are, then the USB support for that controller type must be available I  the OS at boot for the device to be detected.  If the OS is seeing the controller then "diskpart" will see it if a disk or storeage type card is inserted. 

    Contact the vendor to get more specific information.

    Again.  This is the wrong forum for your issue.  Your issue has nothing to do with scripting.


    \_(ツ)_/

    Friday, March 22, 2019 5:23 PM