?
Solved

VBS to delete old profiles

Posted on 2008-10-23
13
Medium Priority
?
2,380 Views
Last Modified: 2013-11-10
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!
0
Comment
Question by:BalchBingham
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
13 Comments
 
LVL 18

Accepted Solution

by:
exx1976 earned 1200 total points
ID: 22788447
Download this

http://www.microsoft.com/downloads/details.aspx?familyid=901a9b95-6063-4462-8150-360394e98e1e&displaylang=en


Then simply run


DelProf /I /D:90

That will delete every profile that hasn't been accessed in 90 days and will ignore errors.  The executable is standalone, so you can push it in a login script.

Enjoy!
0
 
LVL 4

Expert Comment

by:futurefiles
ID: 22788526
what about if the profiles are stored on a different volume? like with roaming profiles?
0
 

Author Comment

by:BalchBingham
ID: 22788653
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?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 18

Expert Comment

by:exx1976
ID: 22788883
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..
0
 
LVL 4

Expert Comment

by:futurefiles
ID: 22789020
no but i do so i wondered if it could help me
0
 
LVL 18

Expert Comment

by:exx1976
ID: 22789085
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.

0
 
LVL 4

Expert Comment

by:futurefiles
ID: 22789123
thought so, thanks
0
 

Author Comment

by:BalchBingham
ID: 22789554
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.
0
 
LVL 18

Expert Comment

by:exx1976
ID: 22789705
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?

0
 

Author Comment

by:BalchBingham
ID: 22789792
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?
0
 
LVL 18

Assisted Solution

by:exx1976
exx1976 earned 1200 total points
ID: 22789829
I think you're confusing profile and account...


You're worried about running this utility and it deleting the local administrator's account.  It will not.  What will happen is when you login with the local administrator's account, it'll be just like the first time you logged into the computer "Creating your profile, configuring IE", all that crap.

Your "floaters", I'm assuming, have DOMAIN accounts, not LOCAL accounts.  Ergo, yes, what you are really after is to remove the profile information, not the account information.  This utility removes profile information.

0
 

Author Comment

by:BalchBingham
ID: 22789875
Excellent, exactly the information I was looking for.  Thank you!!
0
 

Author Closing Comment

by:BalchBingham
ID: 31509309
Thanks for all your help!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question