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
:: 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 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
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.