{"id":179,"date":"2008-04-13T12:09:42","date_gmt":"2008-04-13T06:39:42","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=179"},"modified":"2025-02-25T08:39:38","modified_gmt":"2025-02-25T03:09:38","slug":"how-to-automatically-login-to-windows-and-then-lock-the-workstation","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/how-to-automatically-login-to-windows-and-then-lock-the-workstation\/","title":{"rendered":"How to Automatically Login and Auto-Lock Workstation After Login"},"content":{"rendered":"<p>Setting up an automatic login in Windows also comes with a great responsibility to safeguard the user account from unauthorized use. After configuring automatic login to your user account, you may also want to set it to lock the workstation immediately at login.<!--more--><\/p>\n<div id=\"toc\">\n<h4>Contents<\/h4>\n<ul>\n<li><a href=\"#autologin\">Step 1: Setting up Automatic Login to Your Account<\/a><\/li>\n<li><a href=\"#autolock\">Step 2: Automatically lock workstation at log on<\/a>\n<ul>\n<li><a href=\"#startupfldr\">Using the Startup folder<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#info\">INFO: Why auto-lock the computer?<\/a><\/li>\n<\/ul>\n<\/div>\n<h2>Auto-login to Windows and auto-lock the computer<\/h2>\n<h3><a id=\"autologin\"><\/a>Setting up Automatic Login to Your Account<\/h3>\n<p>To automatically login to your account at startup, follow these steps:<\/p>\n<ol>\n<li>Press <kbd>WinKey<\/kbd> + <kbd>R<\/kbd>, and type the following, and press <kbd>Enter<\/kbd>:\n<pre>control userpasswords2<\/pre>\n<\/li>\n<li>Uncheck &#8220;Users must enter a user name and password to use this computer.&#8221;<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3397\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/07\/autologon-lock-1.png\" alt=\"Automatic logon and lock workstation\" width=\"463\" height=\"510\" \/><\/li>\n<li>Click OK.<\/li>\n<li>When prompted, type in your user name and password and click OK.<\/li>\n<\/ol>\n<p>The system is now set to log in to your user account automatically. The auto-login credentials such as the username, password, and the computer (domain) name are securely <a href=\"https:\/\/www.winhelponline.com\/blog\/duplicate-users-windows-login-screen\/\">stored in the registry<\/a>.<\/p>\n<p>The above steps work in all Windows client Operating Systems, including Windows 11.<\/p>\n<div class=\"rp\"><strong>RELATED:<\/strong> <a href=\"https:\/\/www.winhelponline.com\/blog\/users-must-enter-a-user-name-and-password-to-use-this-computer-missing-windows-10\/\">&#8220;Users must enter a user name and password to use this computer&#8221; option missing<\/a><\/div>\n<h3><a id=\"autolock\"><\/a>Automatically lock workstation at log on<\/h3>\n<p>You may now create a Scheduled Task to lock the workstation immediately when you log in.<\/p>\n<ol>\n<li>Start Task Scheduler, and click &#8220;Create Basic Task&#8230;&#8221; in the Actions pane.<\/li>\n<li>Select &#8220;When I log on&#8221; in the Task Trigger dialog, and click Next.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3396\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/07\/autologon-lock-2.png\" alt=\"Automatic logon and lock workstation\" width=\"649\" height=\"324\" \/><\/li>\n<li>In the Action dialog, click &#8220;Start a program&#8221; and click Next<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3395\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/07\/autologon-lock-3.png\" alt=\"Automatic logon and lock workstation\" width=\"649\" height=\"323\" \/><\/li>\n<li>In the next dialog, type the Program name as: <code><b>C:\\Windows\\System32\\rundll32.exe<\/b><\/code><\/li>\n<li>In the &#8220;Add arguments&#8221; text box, type <code><b>user32.dll, LockWorkStation<br \/>\n<\/b><\/code><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3394\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/04\/autologon-lock-4-1.png\" alt=\"Automatic logon and lock workstation\" width=\"650\" height=\"300\" \/><br \/>\nSo the command-line that would be executed is:<\/p>\n<pre>rundll32 user32.dll, LockWorkStation<\/pre>\n<p>The parameter is <b>case-sensitive<\/b>; Make sure you type exactly as given. Follow the on-screen instructions and finish the procedure.<\/li>\n<\/ol>\n<p>You&#8217;ve now created a task that locks the workstation immediately after login.<\/p>\n<div class=\"qt\">\n<h3>The task does not work?<\/h3>\n<p>In case the above task doesn&#8217;t work, it may be possible that it&#8217;s being triggered too early. In that case, you may set a time delay (e.g., <code>5<\/code> or <code>10<\/code> seconds) before the task is executed.<\/p>\n<ol>\n<li>Double-click the task to open its Properties<\/li>\n<li>Click on the Triggers tab.<\/li>\n<li>Click on the <strong>Edit&#8230;<\/strong> button.<\/li>\n<li>Enable the <strong>Delay task for:<\/strong> checkbox and set it to 5 or 10 seconds.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18790\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/04\/autolock-pc-scheduler-time-delay.png\" alt=\"auto login and lock scheduler time delay\" width=\"700\" height=\"643\" \/><\/li>\n<li>Click Ok, Ok to complete the process.<\/li>\n<\/ol>\n<\/div>\n<div class=\"rp\"><strong>RELATED:<\/strong> <a href=\"https:\/\/www.winhelponline.com\/blog\/auto-turn-off-monitor-when-lock-computer-workstation\/\">Automatically Turn off Monitor when you Lock your Computer<\/a><\/div>\n<h4><a id=\"startupfldr\"><\/a>Startup folder<\/h4>\n<p>The same command can be run from the Startup folder using a shortcut, but items in the Startup folder are executed very late, which means your desktop would be exposed until the &#8220;lock workstation&#8221; shortcut kicks in. When you run it using Task Scheduler, the task is executed immediately after you type in your credentials and login is validated.<\/p>\n<p>There are chances that the task fails to run at logon, especially if the Scheduler service doesn&#8217;t start or if the task is triggered too early. As a fallback, you may create a shortcut to the <code>rundll32.exe <\/code><code>user32.dll, LockWorkStation<\/code>\u00a0command-line above and place it in your Startup folder.<\/p>\n<p>The Startup folder of your profile can be accessed by running the following <a href=\"https:\/\/www.winhelponline.com\/blog\/shell-commands-to-access-the-special-folders\/\">shell: command<\/a> from the Run dialog:<\/p>\n<pre>shell:startup<\/pre>\n<p>Or by accessing the following folder directly.<\/p>\n<pre>C:\\Users\\%username%\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3419\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/04\/autologon-lock-5.png\" alt=\"Automatic logon and lock workstation\" width=\"650\" height=\"245\" \/><\/p>\n<p><em>Alternatively, creating a shortcut to <code>tsdiscon.exe<\/code> (for Pro editions and higher) would work, too.<\/em><\/p>\n<div class=\"qt\">\n<h3><a id=\"info\"><\/a>Why auto-lock the computer?<\/h3>\n<p>The very reason for setting up automatic login is to avoid typing your credentials or your PIN if you&#8217;ve set up one. So, what&#8217;s the point of locking the workstation after logging in to your user account?<\/p>\n<p>There are situations where it may be necessary. Many folks would want to this. Turn on the computer and come back again after a couple of minutes or so. In the meantime, the system would do the following automatically:<\/p>\n<ul>\n<li>Log in to your account (Winlogon initialization phase) using stored credentials.<\/li>\n<li>Lock the workstation.<\/li>\n<li>Run all the startup tasks &amp; programs (Explorer initialization phase.)<\/li>\n<li>Run the <a href=\"https:\/\/www.winhelponline.com\/blog\/service-startup-automatic-vs-automatic-delayed-start\/\">delayed start<\/a> services (post-boot phase), and get things initialized for you.<\/li>\n<\/ul>\n<p>When you come back, the <a href=\"https:\/\/www.winhelponline.com\/blog\/program-constantly-writing-hard-disk-io\/\">disk I\/O<\/a> and <a href=\"https:\/\/www.winhelponline.com\/blog\/pc-doctor-module-high-cpu-memory-and-disk-usage-and-slowdown\/\">CPU usage<\/a> will be normal. All you need to do is type in your PIN or password and start using the system.<\/p>\n<p>Here is another case where this is needed:<\/p>\n<blockquote><p><i>Our IT department has begun pushing out periodic Automated Updates overnight which subsequently reboot my workstation. The negative result of this process is my scheduled tasks, which require my network credentials, fail because I am no longer logged into the network when the task is scheduled to run. I leave my workstation logged in and locked (for security) when unattended.<\/i><\/p><\/blockquote>\n<\/div>\n<p>The above method(s) won&#8217;t provide you foolproof security, but it&#8217;s a far better option than leaving your system unlocked when it&#8217;s unattended. If you&#8217;re extremely concerned about security, you won&#8217;t be using automatic logon in the first place.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting up an automatic login in Windows also comes with a great responsibility to safeguard the user account from unauthorized use. After configuring automatic login to your user account, you may also want to set it to lock the workstation immediately at login.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[7],"tags":[],"class_list":["post-179","post","type-post","status-publish","format-standard","hentry","category-windows"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":24393,"url":"https:\/\/www.winhelponline.com\/blog\/auto-login-user-account-windows-11\/","url_meta":{"origin":179,"position":0},"title":"How to Automatically Login to your Account in Windows 11 and Earlier","author":"Ramesh","date":"October 11, 2021","format":false,"excerpt":"Every version of Windows, from Windows 2000 to Windows 11, allows you to automatically log in to your user account without typing the password. This is possible by securely storing the user account credentials using the Netplwiz.exe utility. However, on Windows 10 and Windows 11, some more steps are necessary\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"automatic login sysinternals autologon","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2021\/10\/w11-auto-login-3.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":18534,"url":"https:\/\/www.winhelponline.com\/blog\/users-must-enter-user-name-and-password-missing\/","url_meta":{"origin":179,"position":1},"title":"&#8220;Users must enter a user name and password&#8221; option missing","author":"Ramesh","date":"September 12, 2020","format":false,"excerpt":"When you open the User Accounts dialog by running control userpasswords2 or netplwiz.exe to configure automatic login to your user account, the Users must enter a user name and password to use this computer option may be missing in that dialog. As a result, you're unable to configure auto-login to\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"userpasswords2 password checkbox missing","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/09\/userpasswords2-option-missing-4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/09\/userpasswords2-option-missing-4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/09\/userpasswords2-option-missing-4.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/09\/userpasswords2-option-missing-4.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":19346,"url":"https:\/\/www.winhelponline.com\/blog\/duplicate-users-windows-login-screen\/","url_meta":{"origin":179,"position":2},"title":"[Fix] Duplicate User Accounts in the Windows 10 or 11 Login Screen","author":"Ramesh","date":"October 18, 2020","format":false,"excerpt":"When you start your Windows 10 or 11 computer, the error \"The user name or password is incorrect\" appears. Also, duplicate user accounts may appear on the login screen. The user name or password is incorrect. Try again. After you click the OK button, you're prompted to enter the correct\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"two user accounts (duplicate) appear at lock screen","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/10\/duplicate-user-accounts-2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":9009,"url":"https:\/\/www.winhelponline.com\/blog\/auto-turn-off-monitor-when-lock-computer-workstation\/","url_meta":{"origin":179,"position":3},"title":"Automatically Turn off Monitor when you Lock your Computer","author":"Ramesh","date":"May 4, 2019","format":false,"excerpt":"We saw how to turn off your monitor or put your computer to sleep mode using shortcuts. Also, we explained how to automatically lock the workstation immediately after automatic login to your account. By default, after you lock your workstation (computer), the display turns off automatically in 1 minute, and\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"turn off monitor when locking computer","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/turn-off-monitor-workstation-lock-m1-3.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5219,"url":"https:\/\/www.winhelponline.com\/blog\/pin-sign-in-changes-password-windows-10\/","url_meta":{"origin":179,"position":4},"title":"Default Sign-in Option Changes to Password from PIN Automatically in Windows 10","author":"Ramesh","date":"January 18, 2017","format":false,"excerpt":"When you sign-in to your user account or unlock the workstation, the last used sign-in method (PIN, Password or Windows Hello) is saved to the registry, and the same will be used the next time. However, you may notice that the default sign-in option reverts to password at every restart,\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"windows 10 login screen header","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/01\/login-screen-2-header.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/01\/login-screen-2-header.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/01\/login-screen-2-header.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5719,"url":"https:\/\/www.winhelponline.com\/blog\/username-password-incorrect-every-restart-windows-10\/","url_meta":{"origin":179,"position":5},"title":"[Windows 10] &#8220;The Username or Password is Incorrect&#8221; Error at Every Restart","author":"Ramesh","date":"October 31, 2017","format":false,"excerpt":"After installing a Feature Update like Fall Creators Update, you may face yet another weird issue. Whenever the computer is restarted, the first screen that may show up even before the login screen is: \"The username or password is incorrect. Try again.\" Note that the above screen shows up even\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"username or password is incorrect windows 10","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/10\/w10-use-my-signin-info.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/10\/w10-use-my-signin-info.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/10\/w10-use-my-signin-info.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/10\/w10-use-my-signin-info.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=179"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}