Windows Command Line Generates Random Password [Solved]

You can always reset the password

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

fix generate random password by windows command line

While we were configuring the built-in administrator account via Command Prompt on one of the workstations, it seemed like the Windows command line automatically generated a random password. As a result, we couldn’t sign in.

When we looked it up, the problem was quite common. While trying to activate the administrator account, users often end up reconfiguring the password for another one.

So, if you are having trouble signing in, leave the password field blank and hit Enter, or try using the Microsoft account password if on a Microsoft account. Also, boot into Safe Mode and check whether Windows now accepts the password.

How do I sign in if the Command Prompt generates a random password?

1. Check the user account

Your primary approach should be to verify the current user account. After activating the built-in administrator account, it might be selected by default on the Windows login screen, and you could enter the password instead of your other account.

Windows login screen

So, select the correct account from the left (all accounts are listed here), and you should be able to sign using the previously set password.

2. Disable the built-in administrator account

  1. On the Windows login screen, click the Power button, then hold the Shift key, and select Restart.
  2. Once the PC enters the Windows RE (Recovery Environment), click on Troubleshoot.troubleshoot
  3. Select Advanced options.
  4. Choose Command Prompt.command prompt
  5. Choose an account for which you know the password, enter it in the text field, and click Continue.
  6. Type the following command and hit Enter: net user administrator /active:nodisable to fix generate random password windows command line
  7. Once done, restart the computer and check whether you can now sign in.

If the Windows command line generates a random password while enabling the administrative user account, you can always disable it and check whether that reverts the changes.

3. Sign in with another account and reset the password

  1. Sign in with the administrator account, the one used to create the affected user profile.
  2. Press Windows + R to open Run, type netplwiz in the text field, and hit Enter.netplwiz
  3. Select the affected account from the list, and click the Reset Password button.reset to fix generate random password windows command line
  4. Enter the new password in both fields, and click OK to confirm.password
  5. Finally, you should be able to sign in to the affected profile using the new password.

Remember, you can only reset the password through the User Accounts utility for local accounts.

4. Remove the affected user account and create a new one

  1. Sign in with another administrator account, press Windows + R, type netplwiz, and click OK.
  2. Select the affected user account, and click Remove.remove
  3. Click Yes in the confirmation prompt.

Once done, you can create a new local account or sign in with a Microsoft account. We would recommend using the latter because you get far more recovery options, which would come in handy in situations like this.

5. Reinstall Windows

If nothing else works after the command line generates a random password, the only option left is to reinstall Windows. You will first need to create a bootable USB, then change the boot border, and finally, use the USB to install Windows.

This will most likely result in data loss. Still, at this point, it’s the most viable solution to regain access because for the built-in recovery options to work, you need the password for at least one administrator account on the PC, which you most likely don’t have.

Also, find out what to do when Windows is not accepting the password, as some of these may help in this case!

For any queries or to share what worked for you, drop a comment below.

More about the topics: Password issues, sign-in issues