1.    20 Feb 2017 #1
    Join Date : Feb 2017
    Posts : 5
    Windows 10

    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 ComputerSystem Spec
  2.    20 Feb 2017 #2
    Join Date : Jul 2015
    Posts : 3,694
    10 Pro

    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 ComputerSystem Spec
  3.    20 Feb 2017 #3
    Join Date : Feb 2017
    Posts : 5
    Windows 10
    Thread Starter

    Quote Originally Posted by lx07 View Post
    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 ComputerSystem Spec
  4.    20 Feb 2017 #4
    Join Date : Feb 2017
    Posts : 5
    Windows 10
    Thread Starter

    Hi lx07, appreciate your help. Unforunately im still getting the same error. See my attached image
    Click image for larger version. 

Name:	DSC_0002.jpg 
Views:	1 
Size:	672.0 KB 
ID:	122131
    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 ComputerSystem Spec
  5.    21 Feb 2017 #5
    Join Date : Jul 2015
    Posts : 3,694
    10 Pro

    Quote Originally Posted by rabwick View Post
    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 ComputerSystem Spec

 


Similar Threads
Thread Forum
Surface Pro 4 Unattended Sysprep Issue
Hi Guys, Im attempting create an unattended sysprep windows 10 installation (1607) for the Surface Pro 4 using a USB and WinPE. I dont have the current script with me but the process is roughly the following; Install win 10 - audit mode...
Installation and Upgrade
Surface September Updates for Surface Pro 4, Surface Book, and Surface 3
Source: September Updates for Surface Pro 4, Surface Book, and Surface 3 Surface
Windows 10 News
Sysprep unable to validate installation. (yet another sysprep case)
Hey everyone, I hope you're doing fine. Well, I'll keep this short and to the point. I want to run sysprep on my Windows 10 Pro (x64) PC and I've faced many errors till now which I somehow managed to dodge , Now I've come across another...
Installation and Upgrade
Surface Pro 4 problems after sysprep and latest upgrade
Okay here's the deal; I have seven of these to set up for users here at work, and we have several applications that need to be preconfigured and standardized for users. Thus the boot into Audit Mode for setup and Sysprepping with...
Installation and Upgrade
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 15:08.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums