Surface Pro 4 Sysprep WinPE Help


  1. Posts : 5
    Windows 10
       #1

    Surface Pro 4 Sysprep WinPE Help


    Hi, im currently close to finishing sysprep on the surface pro 4. Im using winpe and StartNet.cmd to run a script, specifically the following script;
    @ECHO OFF
    :: Geovert
    :: 2016-03-09
    :: Deploy Windows 10

    wpeinit

    echo select disk 0 > diskpart%ID%.txt
    echo clean >> diskpart%ID%.txt
    echo convert gpt >> diskpart%ID%.txt
    echo create partition efi size=200 >> diskpart%ID%.txt
    echo assign letter="s" >> diskpart%ID%.txt
    echo format quick fs=FAT32 >> diskpart%ID%.txt
    echo create partition msr size=128 >> diskpart%ID%.txt
    echo create partition primary >> diskpart%ID%.txt
    echo assign letter="c" >> diskpart%ID%.txt
    echo format quick fs=NTFS >> diskpart%ID%.txt

    echo ** Executing diskpart script...
    diskpart /s diskpart%ID%.txt
    del diskpart%ID%.txt

    echo select disk 1 > diskpart%ID%.txt
    echo select partition 1 >> diskpart%ID%.txt
    echo assign letter="g" >> diskpart%ID%.txt

    echo ** Executing diskpart script...
    diskpart /s diskpart%ID%.txt
    del diskpart%ID%.txt

    dism /apply-image /imagefile:g:\efisys.wim /index:1 /ApplyDir:s:\
    dism /apply-image /imagefile:g:\OSimage.wim /index:1 /ApplyDir:c:\

    bcdedit /set {bootmgr} device partition=s:
    bcdedit /set {memdiag} device partition=s:

    bcdedit /set {default} device partition=c:
    bcdedit /set {default} osdevice partition=c:

    Bcdedit /set {FWbootmgr} displayorder {Bootmgr} /addfirst

    wpeutil shutdown
    from a USB with both my .wim files on the USB.
    Strangely, typing each command from the script in WinPE manually will work every time without fail, however when running the automated script with the same commands once it hits the line to assign letter 'c' the error is thrown: virtual service disk error: letter is already assigned.
    Once the script is typed manually at least once the automatic script will work fine after, however if i boot into gparted and remove all partitions or if i do a internal secure wipe with parted magic the script will not run automatically unless i type the commands manually again at least once, in which the automated script will run thereafter.
    I have noticed in gparted if i delete the partitions THEN make the drive ntfs i can then run the script automatically fine without having to type it manually. Im confused as to why typing the commands manually works but the script automatically does not even though they're the same commands.
      My Computer


  2. Posts : 5,478
    2004
       #2

    Don't you have to select the partition before assigning a letter?

    In your script you create the partitions but assign letters without selecting the partition. More like this perhaps..

    echo select disk 0 > diskpart%ID%.txt
    echo clean >> diskpart%ID%.txt
    echo convert gpt >> diskpart%ID%.txt
    echo create partition efi size=200 >> diskpart%ID%.txt
    echo select partition 1 >> diskpart%ID%.txt
    echo assign letter="s" >> diskpart%ID%.txt
    echo format quick fs=FAT32 >> diskpart%ID%.txt
    echo create partition msr size=128 >> diskpart%ID%.txt
    echo create partition primary >> diskpart%ID%.txt
    echo select partition 3 >> diskpart%ID%.txt
    echo assign letter="c" >> diskpart%ID%.txt
    echo format quick fs=NTFS >> diskpart%ID%.txt
      My Computer


  3. Posts : 5
    Windows 10
    Thread Starter
       #3

    lx07 said:
    Don't you have to select the partition before assigning a letter?

    In your script you create the partitions but assign letters without selecting the partition. More like this perhaps..

    echo select disk 0 > diskpart%ID%.txt
    echo clean >> diskpart%ID%.txt
    echo convert gpt >> diskpart%ID%.txt
    echo create partition efi size=200 >> diskpart%ID%.txt
    echo select partition 1 >> diskpart%ID%.txt
    echo assign letter="s" >> diskpart%ID%.txt
    echo format quick fs=FAT32 >> diskpart%ID%.txt
    echo create partition msr size=128 >> diskpart%ID%.txt
    echo create partition primary >> diskpart%ID%.txt
    echo select partition 3 >> diskpart%ID%.txt
    echo assign letter="c" >> diskpart%ID%.txt
    echo format quick fs=NTFS >> diskpart%ID%.txt
    Hmm i definately did not think of that, ill test this tomorow and return with an answer. With regard to that section of the script i got it from here:

    https://technet.microsoft.com/en-us/...(v=ws.10).aspx
      My Computer


  4. Posts : 5
    Windows 10
    Thread Starter
       #4

    Hi lx07, appreciate your help. Unforunately im still getting the same error. See my attached image
    Surface Pro 4 Sysprep WinPE Help-dsc_0002.jpg
    Im really unsure why typing it manually works but the script does not unless i use gparted to make the disk NTFS before running the script, however typing the commands manually i dont need to use gparted at all...

    Is there something wrong with my script?
      My Computer


  5. Posts : 5,478
    2004
       #5

    rabwick said:
    Is there something wrong with my script?
    Not that I can see. Perhaps someone else can.

    I saw this old thread but it didn't seem to go anywhere. Diskpart error when imaging Win7 - Unattended Windows 7/Server 2008R2 - MSFN

    The idea wasn't bad though. Break up the script and put 'pause' in. Then perhaps you could put some diskpart "list volume", "list partition" "list disk" or the other diagnostic commands in your TechNet thread.

    It seems that C is already assigned when the script runs but I can't think why. Could be you need to select the volume and remove the letter.

    I was wrong about needing "select partition" by the way. When you create a partition it automatically gets focus so your script was OK in the first place.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:30.
Find Us




Windows 10 Forums