Solved

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

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

Suggested Solutions

Title # Comments Views Activity
exchange powershell question 5 34
Exchange powershell help 2 30
Never expired checked 2 19
Powershell replace german characters in string 12 29
Utilizing an array to gracefully append to a list of EmailAddresses
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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