Skip to content

Instantly share code, notes, and snippets.

@Techlogist
Last active October 3, 2021 12:37
Show Gist options
  • Save Techlogist/f87a386e5075e2f3d97e2cc0d7ac0e50 to your computer and use it in GitHub Desktop.
Save Techlogist/f87a386e5075e2f3d97e2cc0d7ac0e50 to your computer and use it in GitHub Desktop.
Show a user's password age and policies
REM License: GNU General Public License v2.0
REM Author: Miguel
REM Website: www.techlogist.net
REM Post: https://techlogist.net/batch/show-a-users-password-age-and-policies
REM Description: Show a user's password age and policies
REM OS/Language/Region: Windows/EN-US
@echo off
title User password policy and validity check
color f0
mode con:cols=70 lines=15
:start
echo.
set /p userid=Please type the username:
echo.
goto process
:process
cls
echo.
echo Your account %userid% has to following policies assigned:
echo.
net accounts /domain |find /i “Maximum password age”
net accounts /domain |find /i “Lockout threshold”
net accounts /domain |find /i “Lockout duration”
net accounts /domain |find /i “Minimum password length”
echo.
echo The password expires:
echo.
net user %userid% /domain |find /i “Password expires”
net user %userid% /domain |find /i “Account active”
echo.
echo Press ENTER to exit.
pause >nul
cls
goto start
REM License: GNU General Public License v2.0
REM Author: Miguel
REM Website: www.techlogist.net
REM Post: https://techlogist.net/batch/show-a-users-password-age-and-policies
REM Description: Show a user's password age and policies once
REM OS/Language/Region: Windows/EN-US
@echo off
title User password policy and validity check
color f0
mode con:cols=70 lines=15
goto Start
:Start
echo.
echo Your account %username% has to following policies assigned:
echo.
net accounts /domain|find /i "Maximum password age"
net accounts /domain|find /i "Lockout threshold"
net accounts /domain |find /i "Lockout duration"
net accounts /domain |find /i "Minimum password length"
echo.
echo Your password expires:
echo.
net user %username% /domain |find /i "Password expires"
echo.
echo Press ENTER to exit.
pause >nul
:EOF
cls
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment