DeployNanoServerPhysical-MBR.ps1
[CmdletBinding()] Param ( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)] $WinPEMedia, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=1)] $Computername, [Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, Position=3)] $OSDrive='Z' ) $BootDrive = $OSDrive $Wimfile=$WinPeMedia+':\NanoServer\Nanocustom.wim' $Disk=Get-AttachedDisk $DriverPath=$WinPEMedia+':\Drivers' New-PartitionStructure -Disk $disk -BootDrive $BootDrive -OSDrive $OsDrive -MBR Expand-WindowsImage –imagepath "$wimfile" –index 1 –ApplyPath "$OSDrive`:\" $Unattendfile='X:\Unattend.xml' $Content=New-UnattendXMLContent -computername $Computername -TimeZone 'Eastern Standard Time' New-Item $Unattendfile -Force -ItemType File Add-Content -path $Unattendfile -value $Content -Force Copy-Item $UnattendFile -destination "$OSDrive`:\Windows\System32\Sysprep" Remove-Item "$OSDrive`:\Windows\Setup\Scripts\SetupComplete.cmd" -Force Send-BootCode -BootDrive $BootDrive -OSDrive $OSDrive If (Test-Path ($DriverPath)) { Add-WindowsDriver -Driver $DriverPath -Recurse -Path "$OSDrive`:\" -ErrorAction SilentlyContinue } |