Delete Profiles VBS Script

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.
E

Eadinator

Thread Starter
I have acquired a script from the internet which deletes all the locally cached profiles on a computer if they are not on the specified list of exceptions.

By default, I think it does something like this:

Gets all the folders in the 'Users' directory > Goes through the list of exceptions > Deletes all the folders which aren't on the list of exceptions > If a folder can't be deleted, it leaves it behind and goes onto the next one. (This means it doesn't hang).

This is ok, but a lot of the time, profiles with incorrect owners are present. In this case, the script won't be able to delete the profile, will move onto the next one, leaving it behind. I need all the folders which are non-exempt to be deleted.

I need it to do the following:

Get all the folders in the 'Users' directory > Go through the list of exceptions > Change the owner of all folders which are non-exempt > Delete all folders which are non-exempt (which it should be able to do at this point) > In case of some unknown error, go onto the next one (for the sake of it not hanging).

I have had a go at this myself, but I haven't quite got it. Note: I may need to set the permissions as well, but if I can get it to set the owner, I can simply add the permissions bit as a switch on the subinacl command.

I have attached the script. Please let me know if you need any more information and thanks for any help with this.

Matthew.
 

Attachments

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Top