Show a user’s password age and policies

Show a user’s password age and policies

This command retrieves the current password, login and lockout policies for both local or domain users.

net accounts
net accounts /domain

The next command is used to retrieve details such as the status, password expiry policy from user accounts in local machines and domains.

net user %username%
net user %username% /domain

By mixing both of these commands in a batch file it becomes possible to display useful account information to the user.

Note: Remove “/domain” for it to work on a local machine user

For an IT support specialist, being able to query different domain usernames is very useful. By adding a couple more lines of code that becomes possible.