header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Deleting disabled user accounts after a certain age
Last Post 07 Jul 2010 08:09 AM by PseudoAdmin. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
Mark TerwillegerUser is Offline
New Member
New Member
Posts:2
Avatar

--
22 Jun 2010 04:11 PM
    Looking for help in collecting about 4800 disabled user accounts that have been disabled a minimum time across a forest and deleting them.  Any help is appreciated.
    PseudoAdminUser is Offline
    New Member
    New Member
    Posts:9
    Avatar

    --
    07 Jul 2010 08:09 AM
    I find that as a novice coder, the powershell community has a lot to offer in the way of simplifying admin tasks. For managing user accounts (and othe AD objects), the powershell commands for Active Directory from Quest Software works best (http://www.quest.com/powershell/). Once you have the snapin installed and loaded, try this:

    $cutoffDate = (get-date).AddDays(-180) #replace 180 with however many days you want to go back
    Get-QADuser -Disabled -LastChangeBefore $cutoffDate | foreach {remove-qadobject $_ -force -whatif}

    Notice the segment of code that actually deletes the accounts has the "-whatif" parameter set. I suggest you test this code as-is to ensure you would only be deleting the accounts you want. If you are sure the list of users is what you want, remove the "-whatif" parameter and run it again.

    -PseudoAdmin


    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer