Solved

Disk Cleanup for all user profiles on Terminal Server - Windows 2008

Posted on 2011-02-22
6
3,825 Views
Last Modified: 2012-05-11
I would like to be able to empty all temp directories for all user profiles on our Terminal Server which is running Windows 2008 R2. How do I action this? When I run disk cleanup as the Administrator it only relates to the Administrator profile. I would really like perform some sort of disk cleanup that will affect all the profiles on the Terminal Server.

Any ideas?

Thank you
0
Comment
Question by:the_omnific
[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
  • 4
6 Comments
 
LVL 9

Expert Comment

by:Lester_Clayton
ID: 34950801
There is no single command or folder you can erase to do all profiles on Terminal Servers.  What you'd have to do is list all the folders in the users area, and then systematically remove all temp folders for each directory.

Example : Dir list of C:\Users reveals 5 users named User1, User2, User3, User4, User5

Then, you'd delete the contents of the 5 following folders.

C:\Users\User1\AppData\Local\Temp\4
C:\Users\User2\AppData\Local\Temp\4
C:\Users\User3\AppData\Local\Temp\4
C:\Users\User4\AppData\Local\Temp\4
C:\Users\User5\AppData\Local\Temp\4

Be careful though - If this folder is missing, it will cause issues - only delete the contents of the folders, not the folders themselves.
0
 
LVL 12

Expert Comment

by:prashanthd
ID: 34951252
Hi,

You can try this code
On Error Resume Next
    
    Dim fs, f, f1, fc, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder("c:\users\")
    Set fc = f.SubFolders
    
    For Each f1 in fc
        temp_path="c:\users\"& f1.Name &"\AppData\Local\Temp\4\*.*"
        fso.DeleteFile temp_path, True 
    Next

Open in new window

0
 
LVL 1

Author Comment

by:the_omnific
ID: 34955324
prashanthd

Please find attached
vberror.jpg
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:the_omnific
ID: 34955358
Lester_Clayton > You mean don't delete the temp folder itself C:\Users\User1\AppData\Local\Temp but we can delete everything inside it including subfolders without causing issues ?
0
 
LVL 1

Accepted Solution

by:
the_omnific earned 0 total points
ID: 34956141
Thank you for your input guys but I have opted to use CCleaner to run in silent mode in everyone's start-up.
0
 
LVL 1

Author Closing Comment

by:the_omnific
ID: 34990875
I have used a different method that I am happy with.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

756 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