Link to home
Start Free TrialLog in
Avatar of BalchBingham
BalchBinghamFlag for United States of America

asked on

VBS to delete old profiles

I need a vb script that will delete all user profiles that have not been accessed within the last 90 days.  The script should exclude required profiles (Administrator, All Users, Default User, etc) but delete all older folders and files.  This script will be pushed out to 500+ machines, so it needs to be fully automated.  I've looked around and found similar scripts, but have been unable to modify them to do exactly what I need.  We do not use Roaming Profiles in our environment.  Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of exx1976
exx1976
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
what about if the profiles are stored on a different volume? like with roaming profiles?
Avatar of BalchBingham

ASKER

That utility works great if I wanted to delete all profiles that haven't been used in X number of days, but I need to exclude certain admin profiles so that they are not deleted.  Is there a switch I can add to the command line?
I have never seen it delete all users or default user.  I'm not sure about the administrator profile.

I do know that you need to either use RunAs or be logged on as an administrator in order to run it though..  ?

Perhaps give it a shot on one machine and see if it does what you want?  I've been using it for years on terminal servers and Citrix servers (in conjunction with UPHClean) to keep the drive space under control, and it works great.

@Futurefiles - he said he doesn't use roaming profiles..
no but i do so i wondered if it could help me
Oh.  LOL

In that case, I doubt it.  I use roaming profiles for my users, and this utility only cleans up the local copies of them.

For instance, when I was running TS, I had 500 users logging into 6 TS boxes.  Sometimes the users wouldn't log onto one of the boxes for weeks at a time (but would log onto other ones - it was an NLB group).  So every night, I ran delprof /I /D:7 to remove all the locally cached profiles that were older than 7 days.  Kept enough free space on the disk for the servers to survive longer than they otherwise would have (only had 18GB disks).  But, the roaming profiles that were centrally stored on the file server were untouched, meaning that the next time the user logged in, the profile just copied down to the TS box again.

thought so, thanks
You're right, it doesn't delete the Default User or All Users profile, but we have a local admin account stored locally on each computer that needs to remain so that we can log into the machine in case it falls off the domain.  Other than that, the utility does exactly what I need it to.  Thanks for your help on this.
Just because the profile is deleted doesn't mean the ACCOUNT is deleted..  Is there anything that important in the profile?  If so, perhaps just script to move those programs/shortcuts to a different directory?

There's not necessarily anything important in the profile, but can you clarify what you mean about the account not being deleted?  Our purpose in cleaning out the Docs and Settings folder is because we've noticed a performance issue when more than 10 or so profiles are being stored.  In our environment, we have "floaters" that will sit at a users desktop for a week or so while the normal user is out.  So over time, we will get computers with 30+ profiles being stored locally, most of which were only accessed once and will never be touched again.
If deleting the profiles leaves the account behind, will we continue to see these performance issues?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent, exactly the information I was looking for.  Thank you!!
Thanks for all your help!