Assign "Account Expires" date to multiple user accounts

  • Thread starter Thread starter Michael O'Brien
  • Start date 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
 
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/
 
Back
Top