|
I'm trying to create a script that'll run on a dialy basis which will delete any user that was disabled 30 days ago. I put together a dsquery statement that'll get me a list of disabled users with the date the user object was last modified, but I can't figure out a way to delete only users that were modified 30 or more days ago...I can pipe the results to dsmod and delete those users...but again that'll be all disabled users and not ones that have been disabled for 30 days. Maybe there's even a way to do it in kix alone without dsquery that I dont' know about...here's the dsquery command I'm using:
dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(sAMAccountName=*)(!name=User Template)(userAccountControl:1.2.840.113556.1.4.803:=2))" -attr sAMAccountName whenChanged -limit 999999
Thanks!
|