Skip to content

Instantly share code, notes, and snippets.

@mcc85s
Created December 14, 2022 13:38
Show Gist options
  • Save mcc85s/b27fcd6c9c1df4992ca6ec11c6144bc0 to your computer and use it in GitHub Desktop.
Save mcc85s/b27fcd6c9c1df4992ca6ec11c6144bc0 to your computer and use it in GitHub Desktop.
$Account = "admin"
$Key = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList"
$Split = @( )
ForEach ($Node in $Key -Split "\\")
{
$Split += $Node
$Path = $Split -join "\"
If (!(Test-Path $Path))
{
New-Item $Path -ItemType Directory -Verbose
}
}
Set-ItemProperty -Path $Path -Name $Account -Type DWORD -Value 0 -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment