How to Set Windows User Account with a Random Password
In this guide, we’ll show you how to generate a strong, random password for your Windows user account.
A good password should include a mix of uppercase/lowercase letters, numbers, and symbols, making it harder for attackers to crack. We’ll cover both command-line and graphical tools to make the process easy.
Let’s get right to it.
Set Random User Account Password From Command Prompt
To automatically generate a random password for a user account using the Windows Net.exe tool, follow the steps below. It works on all versions of Windows from XP up to Windows 11.
1. Click the Start button or press the Win key and type cmd followed by holding Ctrl+Shift and pressing Enter.
2. Click the Yes button on the User Account Control window (If UAC is enabled) and a Command Prompt window will appear.
3. Type the following command to generate a random password for the user account. Simply replace the word Raymondcc in the command line below with the username that you want to set a random password. Type “Net User” on its own to get a list of account names available on the computer.
Net User Raymondcc /random
The new random password is generated and shown with the status message saying “The command completed successfully“. There is no need to supply the current password for the user account. The password length is set to eight characters long and cannot be changed. It will consist of upper and lower case letters, numbers, and special characters.

Make sure to memorize or save the password because you won’t be able to retrieve it once you close the console window. However, if you lose the password, you can simply run the Net random command again to get a new password (provided you haven’t logged out of Windows before doing so).
Getting An Error Running the Net Command
If you get the error message “System error 5 has occurred. Access is denied”, it means that your account doesn’t belong to the administrator group or you did not launch the command prompt as administrator. Pay special attention to step 1 above where we suggest you hold Ctrl+Shift followed by pressing Enter. Alternatively, right click cmd.exe in the Start menu and select “Run as administrator”.

This method will only work for local accounts and not online Microsoft accounts, it should also work on a domain.
Set User Account Password From a GUI Utility
While setting a random password from the command line for a user account is not that difficult, many people don’t like using a text based interface like Command Prompt. However, there is a simple little tool available where you can do the same thing from the comfort of a graphical user interface. And best of all, it’s made by us!
The Raymondcc User Account Password Changer (RUAPC for short) is a portable tool that we created back in 2017 to quickly and easily change or clear the passwords for Windows local user accounts. It includes an option to set a random password the same as the Net command does.

All you have to do is run the program (administrator access is required) and select a user account from the dropdown list. Check the “Random Password” box and click the Change button. If you are unhappy with the password it generates, simply press the Change button again to get a new one. Similar Net commands to above are run in the background.
Download User Account Password Changer
We also have a slightly modified version of the original tool that performs the extra task of copying the created password to the clipboard. This makes it easier to save or memorize the password after the tool has been closed (because you can’t retrieve it after you click OK). However, this small change does make the tool more prone to being detected as malicious by security software such as Windows Defender.
Download User Account Password Changer (modified for save to clipboard)
I forgot to memorize that password. Is there any sequence or set of password that we can try to login again. Im stuck now. Pls help?
This might help:
raymond.cc/blog/change-xp-administrator-password-without-knowing-it/
Is there a way to reverse this command
That would not be possible. First, the setting changes the password for the user in AD or locally. Second, it would mean that somehow the initial command stored or cached the original password, which is not going to occur.
Thanks Raymond!
BTW, it seems to work just fine for AD user accounts. I just updated an AD user and it went through with no issues!
dude i typed in my cmd; net user administrator /random and it says my password may have been changed? what would happen and what can i do?
Good effort.
Net user administration /random. I typed like this it also generated password but again I couldn’t login. What should I do now??
Take care to note the password exactly as shown as it’s case sensitive.
Also, is your user really called “administration” or are you trying to log on as the built in “administrator”?
Nice one Raymond.