Expired users

M

mark olczyk

We have a bunch of users students (3000 - 3500) in our Collage, we usually
create account for them that will expire in 2 years, we have been doing this
for about 5 years now, so I know that more then half of those account are
expired, but Windows does not show which one expired; unless I go and look
inside users properties, is there a way to display accounts that expired in
a different color or any script that we can run and remove expired accounts,
any help is greatly appreciated. Thanks.
 
J

Jerold Schulman

We have a bunch of users students (3000 - 3500) in our Collage, we usually
create account for them that will expire in 2 years, we have been doing this
for about 5 years now, so I know that more then half of those account are
expired, but Windows does not show which one expired; unless I go and look
inside users properties, is there a way to display accounts that expired in
a different color or any script that we can run and remove expired accounts,
any help is greatly appreciated. Thanks.
You have a number of options. Perform the following from a Windows XP member workstation, while logged on as a domain administrator, or from a Windows Server 2003 domain member or DC.

To find all user accounts that have been inactive for 13 weeks, open a CMD.EXE window and type:

dsquery user -inactive 13 -limit 0

To find all user accounts that have been inactive for 13 weeks and show the DN, display name, and account expiration:

dsquery user -inactive 13 -limit 0|dsget user -dn -display -acctexpires

See tip 6820 in the 'Tips & Tricks' at http://www.jsiinc.com
See tip 7714
See tip 7992

To To find all user accounts that have been inactive for 13 weeks and show the DN, display name, and account expiration, excluding those accounts that Never expire:

for /f "Tokens=*" %a in ('dsquery user -inactive 13 -limit 0^|dsget user -dn -display -acctexpires^|FIND /I /V "never"') do @echo %a


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top