Skip to content

Instantly share code, notes, and snippets.

@labrown
Forked from joefitzgerald/sysprep-and-seal.ps1
Created October 21, 2015 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save labrown/0a0e57af61e2dc1a56b3 to your computer and use it in GitHub Desktop.
Save labrown/0a0e57af61e2dc1a56b3 to your computer and use it in GitHub Desktop.
Sysprep And Remove Vagrant User
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SysprepAndSeal" -ErrorAction SilentlyContinue
$ObjUser = [ADSI]"WinNT://localhost/vagrant";
$ObjUser.userflags = 2;
$ObjUser.setinfo();
C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /quiet /shutdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment