Solved

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

Posted on 2009-07-08
4
434 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

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.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

696 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