Skip to content

Batch Script Net Accounts

Learn how to use the net accounts command in Windows batch scripts to view and modify password and logon restrictions, including minimum password length, password age limits, and forced logoff settings.

Net Accounts

net accounts command views the current password and logon restrictions for the computer.

Syntaxbatch
net accounts [/forcelogoff:{minutes | NO}] [/minpwlen:length] [/maxpwage:{days | UNLIMITED}] [/minpwage:days] [/uniquepw:number] [/DOMAIN]

where:

  • forcelogoff force the log-off of the current user within a defined time period
  • minpwlen this is the minimum password length setting to provide for the user
  • maxpwage this is the maximum password age setting to provide for the user
  • minpwage this is the minimum password age setting to provide for the user

Example

net accounts
Outputplaintext
Force user logoff how long after time expires?: Never
Minimum password age (days): 0
Maximum password age (days): 42
Minimum password length: 0
Length of password history maintained: None
Lockout threshold: Never
Lockout duration (minutes): 30
Lockout observation window (minutes): 30
Computer role: SERVER
The command completed successfully.
Navigation