Skip to content

Instantly share code, notes, and snippets.

@miticollo
Created June 15, 2026 02:13
Show Gist options
  • Select an option

  • Save miticollo/72e9a71e3cc93d311fe3e2634682fc65 to your computer and use it in GitHub Desktop.

Select an option

Save miticollo/72e9a71e3cc93d311fe3e2634682fc65 to your computer and use it in GitHub Desktop.
Logoff from current user when LogonUI.exe exits after OOBE and first logon
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>powershell.exe -WindowStyle Hidden -ep unrestricted -nop -NonInteractive -c &quot;while (1) { if (! $(gwmi -Class Win32_Process -Filter &apos;name=&apos;&apos;LogonUI.exe&apos;&apos;&apos; -ea:SilentlyContinue)) { shutdown /L }; sleep 1 }&quot;</CommandLine>
<Description></Description>
</SynchronousCommand>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment