Solved

Script to delete all documents from My Documents and Desktop of a specific user

Posted on 2009-07-08
4
431 Views
Last Modified: 2012-05-07
Hi, I am looking for a log on or log off script which can be pushed out with group policy which will delete all documents in the My Documents and Desktop of a specific user.

The script should proceed on errors and hopefully leave a log file of results (files skipped and deleted) in the c:\

Thanks!
0
Comment
Question by:susnewyork
  • 2
4 Comments
 
LVL 66

Expert Comment

by:johnb6767
ID: 24807324
Would a Mandatory Profile be an option for you? If you are only looking to delete from those two folders, maybe not, but if you want NO changes saved at logoff, might be an option....
 Create an XP Pro Mandatory User Profile on the Local Machine
http://www.softwaretipsandtricks.com/windowsxp/articles/457/1/Create-an-XP-Pro-Mandatory-User-Profile-on-the-Local-Machine
Might not be what you need, but thought I would offer....
0
 
LVL 11

Accepted Solution

by:
loftyworm earned 250 total points
ID: 24807364
Her si a fast brain dump
make 2 batches.  the first does the work, the second starts the first file and logs its progress.

TEST TEST TEST!!!!!!


:::::::::::::::::::::

:::: file_clean.bat

::::::::::::::::::::::
 

del /f /y C:\documents and settings\user\desktop\

del /f /y C:\documents and settings\user\Mydocuments\
 

:::::::::::::::::::

:::: Run_and_log.bat

:::::::::::::::::::

start File_clean.bat >> log.txt

Open in new window

0
 
LVL 1

Author Comment

by:susnewyork
ID: 24807473
Mandatory profile is definatly not an option for me.
0
 
LVL 66

Assisted Solution

by:johnb6767
johnb6767 earned 250 total points
ID: 24831650
Is this going to be the currently logged in user, so the same script will need to run on each PC?
I would actualy use the following syntax.....
del /f /y %USERPROFILE%\desktop\*.*
del /f /y %USERPROFILE%\user\Mydocuments\*.*
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now