auto delete home folders? server 2003

Flakes

Limp Gawd
Joined
Jun 10, 2009
Messages
185
hi guys,

wondering if any of you can help me with a small issue, ive been asked to go through actve directory and delete all disabled accounts, now luckily all these accounts are in the same ou, however each account has a home folder, im wondering if theres an easy way to select all accounts and delete the home folder with the account? my first thought was to use a script to delete the home folder and account however google has shown me nothing, and although i have wrote a few scripts in the past i didnt fancy risking this one so much incase i typed something incorrectly(therefore deleting everything :eek:).

thanks,
Flakes
 
First i would have management go through the home folders to see if there is anything they need to keep.

Then i would just delete them, how many are we talking about?

And moved your disabled users to a different OU
 
all the disabled accounts are in an ou called "disabled accounts" this is pretty much a back log, there has never been a proper policy in place for deletion of accounts, some of the people havnt worked here for around 5 years, there are around 80 accounts for deletion all of which have a home folder attached, none of the work in the folders is needed anymore.

i was just hoping there was a better way rather than checking each accounts home folder, deleting it, then deleting the account, then moving to the next account.

This is all comming about because there is a total lack of policys for anything here were i work, so me and a few other it techs are forcing the change... were a school and dont even have an acecptable use policy for the kids... thats how bad it is.
 
Do the users home folders match their username, or contain their username as some portion of their name?

If so, its realtively easy to write a vbscript to generate a list of folders in a particular directory for whom either their is no matching account name or for which the account is disabled. That script could either go ahead and delete the folders, or to be a little more safe just make a list that could be fed into another script to perform the actual deletions, depending on your needs/legal requirements.
 
hmm nessus i never thought about the list thing, first then delete.

yes all the home folders start with a folder which corresponds to the username of that particular person.
 
Back
Top