Solved

creating a vbs script

Posted on 2009-04-07
1
309 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 500 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

Suggested Solutions

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

732 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