Created
July 11, 2018 07:51
-
-
Save mbrouwer/7b6c4eac7449793cba613658a58e46a5 to your computer and use it in GitHub Desktop.
Sysprep Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
write-host "Remove unattended.xml" | |
if ( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ) { rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force} | |
& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit | |
write-host "SysPrep image" | |
while ($true) { | |
$imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState | |
if ($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { | |
Write-Output $imageState.ImageState | |
Start-Sleep -s 10 | |
} | |
else { | |
break | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment