≡ Menu

Net accounts command

Net accounts command allows administrators to control user account logon settings from command line. Below you can find the syntax of net accounts command explained with examples.

List the current user accounts settings.

c:\>net accounts
Force user logoff how long after time expires?: 0
Minimum password age (days): 0
Maximum password age (days): 120
Minimum password length: 8
Length of password history maintained: 5
Lockout threshold: 10
Lockout duration (minutes): 60
Lockout observation window (minutes): 30
Computer role: WORKSTATION

Change the minimum password length:

Below is an example command to set the minimum password length to 5.

net accounts /MINPWLEN:5

Set password expiry period

Below is the command to set the password age to 90 days.

net accounts /MAXPWAGE:90

Never expire the password


Set number of the previous passwords remembered.

This prevents the user from reusing any of the remembered previous passwords.

net accounts /UNIQUEPW:4

The above command set the history length to 4.

11 comments… add one
  • doy viray

    thank you for this article, my question is, how to i set the lockout duration using net accounts?

    • irons

      use this command:
      net accounts /FORCELOGOFF:5

      This sets it to 5 minutes.

    • LindaL

      Huh? FORCELOGOFF is not the same as DURATION OF LOCKOUT

  • DebbyDDD

    How do you use the cmd line to edit the 3 “password lockout” values?

    • MarvM

      net accounts /lockoutthreshold:3

  • query

    How do you enable the “require password complexity requirements” using cmd?

    • simonomega

      Enabling “require password complexity requirements” can be done from the security policy editor. You will see a lot of

      Export your current Security Policy.
      secedit /export /cfg %userprofile%\Desktop\CurrentSec.txt
      Open CurrentSec.txt on your desktop.
      You will want to change the complexity line to “1”.
      Save the file.
      Import the New Security Policy.
      secedit /configure /db %windir%\security\local.sdb /cfg %userprofile%\Desktop\CurrentSec.txt /areas SECURITYPOLICY

  • DonnaDD

    > net accounts /MAXPWAGE:90

    Which users will that affect? Everyone on the domain? All the local accounts on this machine? The current local account?
    The current domain account?

    • Tom

      I tested the command string ‘net accounts /maxpwage:300’ to confirm what I thought…. running this command doesn’t change the settings already in place for current users that are set for their password to never expire. It changes the system’s default only. I haven’t tested it for users that are configured to have their passwords expire, but my guess is it would affect those whose password is already set to expire based on the system default.

  • Fernando

    Hi, I want to lockout a workstation.
    The lockout will be as long as a want, then I will run a command using VSA to unlock.
    Any ideas what commant shoul I use

  • Nik

    How can i create windows command script for this ?
    i got too much user to deploy this things .

Cancel reply

Leave a Comment