Last active
August 29, 2015 14:22
-
-
Save BladeFireLight/52ec11bb595163776b01 to your computer and use it in GitHub Desktop.
SysPrep script for use with Start-ImageBuild.ps1
This file contains 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
#requires -Version 1 -Modules ScheduledTasks, ServerManager | |
#region cleanup | |
Start-Transcript -Path c:\sysprep.log | |
Get-ScheduledTask -TaskName AtStartup | Unregister-ScheduledTask -Confirm:$false | |
Remove-Item -Path c:\unattend.xml | |
Get-ChildItem -Path c:\pstemp\ -Exclude AtStartup.ps1 | Remove-Item | |
Get-WindowsFeature | | |
Where-Object -FilterScript { | |
$_.Installed -eq 0 -and $_.InstallState -eq 'Available' | |
} | | |
Uninstall-WindowsFeature -remove | |
Dism.exe /online /cleanup-image /StartComponentCleanup /ResetBase | |
Defrag.exe c: /UVX | |
#endregion | |
#region sysprep | |
C:\Windows\System32\sysprep\sysprep.exe /quiet /generalize /oobe /shutdown /mode:vm | |
Stop-Transcript | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment