?
Solved

GPO : delete temp folder at logoff

Posted on 2007-12-06
7
Medium Priority
?
14,637 Views
Last Modified: 2011-09-30
need to delete temp folder for all user on domain at logoff
- would like to use group policy
- delete all files and subfolder in temp folder

del /s /q /f "%temp%\*.*"
I entered that in the cmd  -  it deletes all files but subfolders still remains(but files empty)
if I need to create a .bat file how would that .bat file look like and how would I add that to GPO to run every  time user logs off - to delete all files and subfolder in the temp folder
0
Comment
Question by:enosuna
[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
7 Comments
 
LVL 10

Expert Comment

by:Rogiee
ID: 20425674
0
 

Author Comment

by:enosuna
ID: 20425702
thank you for the info..but not exactly what I'm looking for.
i want to run a script at logoff through group policy
without having to use xecutor
0
 
LVL 26

Expert Comment

by:Farhan Kazi
ID: 20425931
Try following batch script it will delete all sub directories inside Temp folder.
:: --- BATCH SCRIPT START ---
DEL /S /Q /F "%TEMP%\*.*"
FOR /D %%d IN ("%TEMP%\*.*") DO RD /S /Q "%%d"
:: --- BATCH SCRIPT END ---

Open in new window

0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 30

Accepted Solution

by:
SteveGTR earned 2000 total points
ID: 20426877
Could always do this:
rd /s /q "%temp%"
mkdir "%temp%"

Open in new window

0
 

Author Comment

by:enosuna
ID: 20432884
how would I add the script the group policy??
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 20433252
Create the script and place it on a commonly accessible network share. Give it a .bat extension.

Open the group policy and select Computer Configuration --> Windows Settings --> Scripts --> Shutdown. Add a reference to the script.
0
 
LVL 20

Expert Comment

by:compdigit44
ID: 36893557
I was able to use the preference to clear the contents of the C:\Windows\Temp fold but I do not think GP preference like variables like &userprofiles%
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Simple Linear Regression
Progress

764 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