Assign "Account Expires" date to multiple user accounts

  • Thread starter Michael O'Brien
  • Start date
M

Michael O'Brien

Can anyone point me to a tool that would allow me to assign the account
expires date to all the user accounts in an spefified OU

Michael
 
R

Robbie Allen

You could use this command:
C:\> for /F "usebackq delims=""" %i in (`dsquery user
"ou=myusers,dc=test,dc=local" -scope onelevel`) do dsmod user -acctexpires
30 %i

Replace ou=myusers,dc=test,dc=local with the OU your users are in, and
replace 30 with the number of days from now you want the accounts to expire.

Or if you want to do it via a script, you could combine these two:
http://rallenhome.com/books/adcookbook/src/06.26-set_account_expiration.vbs.txt
http://rallenhome.com/books/adcookbook/src/06.05-modify_multiple_users.vbs.txt

Robbie Allen
Author of "Active Directory Cookbook" (O'Reilly and Associates)
http://www.rallenhome.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