PowerShell PS1 script for creating a bootable copy of Windows Server 2016 Eval Media

This PowerShell assumes you have downloaded and mounted the Windows Server 2016 TP5 ISO and it is mounted as the X: drive of your device.  It does not hide the disk like the normal Windows To Go wizard or the PowerShell scripts for Windows To Go do and this is not warrantied or an official Microsoft Script.


Download the software, mount the disk ISO image (script below assumes the X: drive is the DVD)

$disknumber = Read-Host 'What Disk would you like to COMPLETELY DELETE and REPARTITION for Windows To Go?'
"you have picked disk $disknumber"
$disk = Get-Disk $disknumber
Clear-Disk -InputObject $disk -RemoveData
Initialize-Disk -InputObject $disk -PartitionStyle MBR
$SystemPartition = New-Partition -InputObject $disk -Size (350MB) -IsActive
Format-Volume -NewFileSystemLabel "UFD-System" -FileSystem FAT32 -Partition $SystemPartition
$OSPartition = New-Partition -InputObject $disk -UseMaximumSize
Format-Volume -NewFileSystemLabel "WTG-Windows10" -FileSystem NTFS -Partition $OSPartition
Set-Partition -InputObject $SystemPartition -NewDriveLetter "Y"
Set-Partition -InputObject $OSPartition -NewDriveLetter "Z"
Get-WindowsImage -ImagePath x:\sources\install.wim
dism /apply-image /imagefile:x:\sources\install.wim /index:1 /applydir:Z:\
BCDBOOT Z:\Windows /f ALL /s Y:

Everything above gets saved into a .PS1 file and then you can execute from a PowerShell command prompt