First you have to install Windows 10 on your Surface Pro 4 (maybe it’s already the case for you)
Then you will have to install what ever you want on that Surface Pro 4 but if you install a program make sure you check the box (if there is one) « Install for ALL users ».
Create WinPE Bootable USB Key
Install Windows ADK
Download the Windows Assessment and Deployment Kit here
Launch adksetup.exe
Click Next
Select « No » and click Next
Click Accept
Keep only Deployment Tools and Windows Preinstallation Environment (Windows PE)
Generate WinPE ISO
Press CTRL + R and type « cmd »
Type the following commands in the CMD
cd C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment
For 64 bits:
copype amd64 C:\winpe64
MakeWinPEMedia /ISO C:\winpe64 C:\winpe64\winpe64.iso
For 32 bits:
copype x86 C:\winpe32
MakeWinPEMedia /ISO C:\winpe32 C:\winpe32\winpe32.iso
USB Key
Now you can download a little tool I use a lot, named Rufus. This tool is useful to create a bootable USB device from an image file like an ISO.
Launch Rufus > Select the ISO > Then change the file system in FAT32.
/!\ You must format the USB key in FAT32 because the UEFI BIOS of the Surface Pro 4 don’t support NTFS (strange right?)
Since we are limited to 5 sysprep maximum per installation I recommend you to try to boot on your freshly created USB Key just to be sure you will not missed the start after the sysprep.
Sysprep the Surface Pro 4
In Windows now go in C:\Windows\System32\sysprep\
And launch sysprep.exe
Check the box « Generalize » and change the Shutdown Options to « Shutdown »
Now you can click « OK ».
If you are lucky it will work at the first try. If not, you are like me.
The error
Sysprep was not able to validate your Windows installation. Review the log file at %WINDIR%\System32\Sysprep\Panther\setupact.log for details. After resolving the issue, use Sysprep to validate your installation again.
Go check the log file
First error log
Bitlocker-Sysprep: Bitlocker is on for the OS volume. Turn Bitlocker off to run Sysprep.
It means that Bitlocker is active for a part of the OS. (Even if you didn’t turned it on)
Fix:
- In the Start menu search for « Powershell »
- Click right on it and « Run as Administrator »
manage-bde -off C:
- Wait for Bitlocker to finish to decrypt the drive
- Try the Sysprep again
Second error log
Package king.com.CandyCrushSodaSaga_1.62.900.0_x86__kgqvnymyfvs32 was installed for a user […]
Again even if you didn’t installed the application you have it in the retail Windows 10 iso.
Fix:
- In the Start menu search for « Powershell »
- Click right on it and « Run As Administrator »
Import-Module Appx
Import-Module Dism
Get-AppxPackage -AllUser | Where PublisherId -eq kgqvnymyfvs32 | Format-List -Property PackageFullName,PackageUserInformation
- Copy the PackageFullName
Remove-AppxPackage -Package PackageFullName
- Try the Sysprep again
In my case I had to do this step again for com.Twitter_5.0.0.0_x86__wgeqdkkx372wm
Fetch the Windows 10 WIM image
Now your Surface Pro 4 is shutdown (don’t start it yet or you will have to do the sysprep again!). Plug-in the WinPE USB Key to the Surface Pro 4 or to his Microsoft Dock (both works).
Press the Volume-Down key and press the power button. Once you see the Surface logo you can release the Power button but keep the Volume-Down pressed. Then the surface is starting WinPE. You should see a command line interpreter.
At that moment X: is your currently running WinPE and C: is your Surface Pro 4 system drive.
In my case I plugged-in a second USB Key (E:) formatted in NTFS (to not be blocked by the 4GB size per file of the FAT32)
Type:
dism /capture-image /imagefile:E:\Surface.wim /capturedir:C:\ /name:Windows
Wait for the end of the capture and type exit
Now you have a beautiful Surface Pro 4 image and you can use it with SCCM for example and it will works perfectly :-D