Enable Autologon (or Disable)

$registrypath = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\winlogon"
set-ItemProperty $registrypath -Name 'AutoAdminLogon' -Value "$autologon"
set-ItemProperty $registrypath -Name 'ForceAutoLogon' -Value "$autologon"
set-ItemProperty $registrypath -Name 'DefaultUsername' -Value "$username"
set-ItemProperty $registrypath -Name 'DefaultDomainName' -Value "$domain"
set-ItemProperty $registrypath -Name 'DefaultPassword' -Value "$password"

Script data

Language - PowerShell

Run as - System / Root User

Script timeout duration - 5 Mins

Script variables

Run time variables - autologon

username

domain

password

Read me

Set the autologon variable to 0 (disabled) or 1 (enabled) Set the username Set the domain, leave blank, or set to the name of the PC for local login. Set name and password