Config Server Firewall

The Net Accounts Command

The net accounts command modifies password and logon requirements for Windows Users. For example, if you want to change the minimum password length, you can do so using the net accounts command.

You can use the net accounts command to change password policy settings on the Windows Server. However, it does not work as expected on Desktop operating systems (Windows 10/11).

Run the net accounts command without any options to display the current password and login policy settings.

net accounts

The output will be the current password policy settings on the computer (or the domain).

The Net Accounts Command

When working on an Active Directory domain environment, always use the /domain option to run the command on the domain controller of the current domain instead of the local computer.

net accounts /domain

Command Options

The following table describes all available options of the net accounts command.

/forcelogoff:{minutes | NO}Use this option to specify the number of minutes to wait before users are forced to log off when their working hours expire. The default value, no, prevents forced logoff.
/minpwlen:lengthUse this option to set the minimum password length on Windows. The range should be between 0 and 14. The default is 6. On Windows 10 and Windows 11, this setting only affects local user accounts.
/maxpwage:{days | UNLIMITED}The number of days before the password expires. The user will be forced to change the password after reaching the limit. Unlimited means passwords never expire.
/minpwage:daysThe minimum number of days a user has to wait before changing the password. Note that administrators can change passwords any time they want.
/uniquepw:numberUse this option to specify the number of unique passwords a user must use before reusing an old password.
/domainRun the command on the domain controller, not on the local computer.

Examples

Set minimum password length to 6:

net accounts /minpwlen:6

Using the /domain option to run the same command on an Active Directory domain environment:

net accounts /domain /minpwlen:8

Set maximum password age to 30 days (users will have to change the password after every 30 days):

net accounts /domain /maxpwage:30

Set maximum password age to unlimited (password never expires):

net accounts /domain /maxpwage:unlimited

Set minimum password age to 10 days (a user must wait for at least 10-days before changing the password again):

net accounts /domain /minpwage:10

Force log-off users 30 minutes after their working hours expired:

net accounts /domain /forcelogoff:30

Set the number of unique passwords users must use to 10:

net accounts /uniquepw:10

While working on the command prompt, you can type net help accounts to view the help page of the net accounts command.

The net accounts command does not seem to work as expected on Windows 10/11. For example, parameters like maximum password age do not affect user accounts created from the new Settings panel.

What Next?

Now you have learned the net accounts command. So here are some of the user and groups related commands: net user to manage users and net localgroup to manage local groups.