Hi,
I want script to auto disable Active Directory users which is not logged in some days(90).
is there any script for that?
kindly help.
Regards,
Rakesh
Technology Tips and News
Hi,
I want script to auto disable Active Directory users which is not logged in some days(90).
is there any script for that?
kindly help.
Regards,
Rakesh
Hi,
here you go: http://blogs.technet.com/b/bahramr/archive/2008/01/25/powershell-script-to-disable-inactive-accounts-in-active-directory.aspx
Hi Rakesh Surve,
Thanks for your post.
Also you could refer to the article.
Hope it is helpful to you.
Best Regards,
Mary Dong
Hi,
You can go with a PowerShell script for that purpose. Basically, what you need to do is just look up the lastLogonTimeStamp attribute, but you should also be aware of those users that haven't yet logged in (just created).
There is also a more advanced way to do inactive users cleanup that involves third-party solutions but can provide you with automation and greater flexibility. Here's a good example of this using a tool called Adaxes. It does exactly what you are asking for plus all the additional stuff. If you need to do AD cleanup regularly and in big volumes, I would have a look at it.
Hi,
Sorry for delay....
I have found power shell command and run it on AD server.
If you run below command you will get Inactive users from last 10days. you can change [timespan]10d option in command as per your requirement.
Search-ADAccount -AccountInactive -TimeSpan ([timespan]10d) -UsersOnly | Set-ADUser -Enabled $false -WhatIf
If you run below command in power shell form last 10days inactive user will disable and also you can run on OU base alos.
Search-ADAccount -AccountInactive -TimeSpan ([timespan]10d) -UsersOnly | Set-ADUser -Enabled $false
Check this.Its worked for me.
also you can add this in Task she dueled .
Thanks
Rakesh S