Skip to content

Instantly share code, notes, and snippets.

@joefitzgerald
Created August 17, 2013 00:19
Show Gist options
  • Save joefitzgerald/6254582 to your computer and use it in GitHub Desktop.
Save joefitzgerald/6254582 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