[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Best Approach for Deletion Script that Runs Nightly

Posted on 2015-02-13
3
Medium Priority
?
130 Views
Last Modified: 2015-05-12
Hola,

Can someone please point me in the correct direction on how to create an efficient script that will delete the following on a nightly basis?

Desktop, except RD, Chrome, etc.
Documents
Downloads
Empty Recycle Bin

This is for a communal PC where C-Suiters are prone to downloading sensitive company/employee info during meetings. They're typically Word or Excel sheets, but the file and format will be dynamic.

In order to alleviate the possibility of these items being leaked, I'd like to run script that will delete certain files, while not deleting the shortcuts that are still needed to conduct meetings.

I'd also like to empty the Recycle Bin at the end of the script.

Is this possible?

Thank you!

J
0
Comment
Question by:Ja Che
3 Comments
 
LVL 7

Expert Comment

by:CorinTack
ID: 40608368
Not to sound like I'm trying to sell a product, but a script is somewhat unreliable to accomplish what you want. The company I work for has a few clients who use Deep Freeze (http://www.faronics.com/products/deep-freeze/enterprise/) to accomplish what you're trying to do; it sets a computer at a certain state (which you determine when you install it). Each time the machine is logged off/logged on, or rebooted (again, your choice) it will clear anything that has been changed, including removing downloaded files, etc.

It works really well in the places where we use it.
0
 
LVL 25

Accepted Solution

by:
NVIT earned 2000 total points
ID: 40608379
Make a .bat file with this:
rem Delete files under every User profile:
rem IMPORTANT: This deletes ALL specified files under ALL user profiles, including administrator.
pushd c:\users

rem You can add other file patterns as needed.
del /s "*.txt" "*.doc" "*.docx" "*.pdf" "*.xls" "*.xlsx"

rem Empty Recycle bin:
rd /s /q c:\$Recycle.Bin

Open in new window

To trigger the .bat, you can run it via the local policy or if you're on a domain, a GPO.

Or, since you want it to run nightly, run it via Task Scheduler, triggered to run at a certain time.
0
 

Author Comment

by:Ja Che
ID: 40609009
Thanks to both you. I'll start with the .bat file and see where I go from there. I think that's what I need, but Deep Freeze will definitely be useful in this environment.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
This article is about my experience upgrading my consulting machine to Windows 10 Version 1709 (The Fall 2017 Creator Update)
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

868 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