Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Need simple script to detect & disable inactive AD user accounts

Reply
Thread Tools Display Modes

Need simple script to detect & disable inactive AD user accounts

 
 
Lanwench [MVP - Exchange]
Guest
Posts: n/a

 
      12-10-2009
Hiya - for a W2003 (not R2) domain with two DCs, I'm being asked to
automatically disable user accounts that have not been used within x days.
This would be for one or two specific OUs only.

I've been looking around but haven't found much that looks like it will do
the trick. I'd like to run this script as a scheduled task once daily, and
I'd like it to output results & actions to a log (heck, as long as I'm at
it, I'd like it to output to the event log too. And I'd like a pony. But a
simple text log file will suffice).

Any ideas? I've poked around on the illustrious Mr. Mueller's site & on the
MS scripting site but I am not seeing anything that will do this...


 
Reply With Quote
 
 
 
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      12-11-2009

"Lanwench [MVP - Exchange]"
< hoo.com> wrote in message
news:...
> Hiya - for a W2003 (not R2) domain with two DCs, I'm being asked to
> automatically disable user accounts that have not been used within x days.
> This would be for one or two specific OUs only.
>
> I've been looking around but haven't found much that looks like it will do
> the trick. I'd like to run this script as a scheduled task once daily, and
> I'd like it to output results & actions to a log (heck, as long as I'm at
> it, I'd like it to output to the event log too. And I'd like a pony. But a
> simple text log file will suffice).
>
> Any ideas? I've poked around on the illustrious Mr. Mueller's site & on
> the MS scripting site but I am not seeing anything that will do this...
>


Highly recommended is Joe Richards' free oldcmp utility. See this link:

http://www.joeware.net/freetools/tools/oldcmp/index.htm

Originally designed to cleanup old computer accounts, but works equally well
handling user accounts. The utility has command line help, but you can also
view the usage link at the bottom of the above page.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


 
Reply With Quote
 
Lanwench [MVP - Exchange]
Guest
Posts: n/a

 
      12-11-2009
Richard Mueller [MVP] <rlmueller-> wrote:
> "Lanwench [MVP - Exchange]"
> < hoo.com> wrote in
> message news:...
>> Hiya - for a W2003 (not R2) domain with two DCs, I'm being asked to
>> automatically disable user accounts that have not been used within x
>> days. This would be for one or two specific OUs only.
>>
>> I've been looking around but haven't found much that looks like it
>> will do the trick. I'd like to run this script as a scheduled task
>> once daily, and I'd like it to output results & actions to a log
>> (heck, as long as I'm at it, I'd like it to output to the event log
>> too. And I'd like a pony. But a simple text log file will suffice).
>>
>> Any ideas? I've poked around on the illustrious Mr. Mueller's site &
>> on the MS scripting site but I am not seeing anything that will do
>> this...

>
> Highly recommended is Joe Richards' free oldcmp utility. See this
> link:
> http://www.joeware.net/freetools/tools/oldcmp/index.htm
>
> Originally designed to cleanup old computer accounts, but works
> equally well handling user accounts. The utility has command line
> help, but you can also view the usage link at the bottom of the above
> page.
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net


Thanks, Richard. I know that utlilty (and I know Mr. Richards!) but I forgot
it could do more than just report as that's all I've ever used it for. I'll
try it



 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      12-11-2009

"Lanwench [MVP - Exchange]"
< hoo.com> wrote in message
news:...
> Richard Mueller [MVP] <rlmueller-> wrote:
>> "Lanwench [MVP - Exchange]"
>> < hoo.com> wrote in
>> message news:...
>>> Hiya - for a W2003 (not R2) domain with two DCs, I'm being asked to
>>> automatically disable user accounts that have not been used within x
>>> days. This would be for one or two specific OUs only.
>>>
>>> I've been looking around but haven't found much that looks like it
>>> will do the trick. I'd like to run this script as a scheduled task
>>> once daily, and I'd like it to output results & actions to a log
>>> (heck, as long as I'm at it, I'd like it to output to the event log
>>> too. And I'd like a pony. But a simple text log file will suffice).
>>>
>>> Any ideas? I've poked around on the illustrious Mr. Mueller's site &
>>> on the MS scripting site but I am not seeing anything that will do
>>> this...

>>
>> Highly recommended is Joe Richards' free oldcmp utility. See this
>> link:
>> http://www.joeware.net/freetools/tools/oldcmp/index.htm
>>
>> Originally designed to cleanup old computer accounts, but works
>> equally well handling user accounts. The utility has command line
>> help, but you can also view the usage link at the bottom of the above
>> page.
>> --
>> Richard Mueller
>> MVP Directory Services
>> Hilltop Lab - http://www.rlmueller.net

>
> Thanks, Richard. I know that utlilty (and I know Mr. Richards!) but I
> forgot it could do more than just report as that's all I've ever used it
> for. I'll try it
>
>


I think most admins use -disable first, then after awhile use -delete. Note
too the safety features, so you really have to be sure before it modifies
too many objects.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


 
Reply With Quote
 
Junior Member
Join Date: Dec 2011
Posts: 12

 
      03-07-2012
Is there a reason that you need to use a script (e.g., because you don't have the budget for a third-party solution)? If you have permission to use a foreign tool, i recommend the freeware version of netwix inactive users tracker for this task. It's what we use to detect and and report on stale AD accounts, and we find it particularly useful because it doesn't cost anything. Worth a look.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GP Logon Script works first time at second user logon Roland Schoen Active Directory 2 11-09-2009 12:19 PM
User accounts doubled up demet Windows Vista Administration 2 11-05-2007 01:10 PM
Administrator log in Ben Windows Vista Administration 41 04-29-2007 11:08 PM
Two identical users at login, not under user accounts. Vista Home Winford Windows Vista Administration 0 04-10-2007 02:26 AM
Re-configuring user accounts kira13 Windows Vista Administration 0 03-22-2007 07:37 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59