Skip to content

Instantly share code, notes, and snippets.

@labrown
Forked from joefitzgerald/sysprep-and-seal.ps1
Created October 21, 2015 19:17

Revisions

  1. @joefitzgerald joefitzgerald created this gist Aug 17, 2013.
    6 changes: 6 additions & 0 deletions sysprep-and-seal.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    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