Home directory clean up on Active Directory Windows Server 2003

20 pts.
Active Directory
Group Policy
Home Directory
Microsoft Windows Server 2003
I am looking to clean up a large amount of user home directories. I am trying to find a way to find user directories that belong to disabled user accounts or belong to no user account at all. Does anyone have a process for this or know of a utility that will generate a report with this information and then move the specifics disabled home drives to a folder in bulk? I prefere not to use a third party software maybe a scrypt or batch file...how to do it step by step.

Answer Wiki

Thanks. We'll let you know when a new response is added.

I use Quest PowerGUI with the AD powerpack. The UI is nice, and within the powerpack you can execute queries against your AD quite easily. For what you ask you can display all disabled accounts and add a filter for homedirectory is not empty, then generate a report from the output.

Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Pjb0222
    I'm an old command line guy so: For Domain CORP.MYCORP.COM (You could use DomainRoot depending on what you are looking to do.) Searching in OU=People To find the distinguished names of users: Default gives distinguished names of oubjects. intersting switches in this case: -disabled | -o SAMID add -disabled to the DSQuery to only pull disabled objects
    dsquery user OU=People,DC=CORP,DC=MYCORP,DC=COM -scope subtree -limit 60000
    To get a listing of information that includes the home directory set in AD:
    dsquery user OU=People,DC=CORP,DC=PEP,DC=PVT -scope subtree -limit 10 | dsget user -disabled -samid -hmdir
    If you don't set Home Directory in AD, I hope it has SAMID within the directory structure to allow you to search / find on it to match to IDs. A simple FOR loop can parse the information and move directories of disabled accounts to a holding location. Using a more complex FOR loop with logic you could drop a flag files in directories of active users and inactive users. Using the flag file as a basis you can parse directoried to find those not associated with an existing ID.
    3,310 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: