Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for expires.bat

(view source code of expires.bat as plain text)

  1. @ECHO OFF
  2. ECHO.>CON
  3. ECHO EXPIRES, Version 1.00 for Windows NT 4 >CON
  4. ECHO List all user ID's that have their password expiration disabled >CON
  5. ECHO.>CON
  6. ECHO Written by Rob van der Woude >CON
  7. ECHO http://www.robvanderwoude.com >CON
  8. ECHO.>CON
  9. ECHO Gathering data, this may take several minutes . . .>CON
  10. ECHO.>CON
  11. ECHO Password never expires for the following user IDs:
  12. ECHO.
  13.  
  14. FOR /F "skip=4 tokens=*" %%A IN ('NET USER /DOMAIN ^| FIND /V "The command completed successfully"') DO CALL :ParseUsers %%A
  15. GOTO:EOF
  16.  
  17. :ParseUsers
  18. FOR %%? IN (%*) DO CALL :ChkAcc %%?
  19. GOTO:EOF
  20.  
  21. :ChkAcc
  22. NET USER %1 /DOMAIN | FIND "Password expires             Never" >NUL
  23. IF NOT ERRORLEVEL 1 ECHO.%1
  24. GOTO:EOF
  25.  

page last modified: 2024-04-16; loaded in 0.0067 seconds