Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

creating a vbs script

Posted on 2009-04-07
1
Medium Priority
?
325 Views
Last Modified: 2012-05-06
Hi I would like to have the following done on the computers on the LAN.

I want a vbs script that will run on a schedule that will clean the following folders.

%userprofile%\Local settings\temp\*.*
%userprofile%\;local settings\temporay internet files\*.*
%windir%\temp\*.*

I would like the script to clean all the unused files and skip the ones that are in use. One problem I have is that does it find the location of these folders with no problems because most of these are hidden folders or do we need to apply attrib switch to make sure the script will run and find the location with no issues. Also I want to know if this script will need to run using admin account.

Thanks for you help
0
Comment
Question by:Zak
[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
1 Comment
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 total points
ID: 24099156
This is a simple batch file that would accomplish it - if you're really in need of a vbscript, I can post that as well (just seems simpler to do this in a batch).

You would need to either promote users to admins to remove windir\temp data, grant them change rights to that folder (which they may have - I think by default power users do), or schedule a separate task to run under system credentials to accomplish that.

Also - the temporary internet files will potentially remove 'all' cookies and history - most cases that may not be ideal (there are products that selectively delete tracking cookies only).  In addition, if the browser is in use, the files will not be removed.

Please note - this is a non-destructive script.  Remove the 'echo' from the last two textual lines to initiate deletion.
set t1="%temp%"
set t2="%userprofile%\local settings\temporary internet files"
set t3="%windir%\temp"
 
for %%a in (%t1% %t2% %t3%) do (
  for /d %%b in (%%a\*) do echo rmdir /s /q "%%b"
  echo del /q %%a
)

Open in new window

0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

730 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