Autologon configuration – PowerShell

Autologon configuration – PowerShell

Sometimes we have the need to configure a computer or a POS-type computer in auto-login mode so that the user has immediate access to the application right after the computer starts. Currently, in Windows 10, there is a possibility to run a device in kiosk mode, but it’s not always sufficient, especially in manufacturing companies.

In a straightforward manner, auto-login can be configured using the Autologon application from the Sysinternals suite (link) or directly in the registry. In this article, I will focus on configuring the registry using PowerShell.

The configuration of auto-login is governed by specific registry entries. In the following steps, we will determine the appropriate values for these keys.

The entries we will be modifying are located in the registry at the path
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

To enable auto-login, we need to:

  • Set the value of AutoAdminLogon to 1.
  • Enter the username in DefaultUserName.
  • Enter the password in DefaultPassword. If this entry doesn’t exist, create it. To do this, click “New,” choose “String Value,” enter DefaultPassword as the name, and enter the password as the value.
  • Enter the domain name in DefaultDomainName, if your computer is connected to a domain and you want to use a domain user for logging in. This field can also remain empty if you enter the username along with the domain in the DefaultUserName field, e.g., domain\username.

After a restart, auto-login should be functional.

Now, let’s focus on how to accomplish these actions using PowerShell. Below is a short script that configures the registry entries:

If the script will be executed on different devices where a different user is utilized on each, you can add lines to prompt the user for input during script execution. It would look like this:

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *