Solved

GPO : delete temp folder at logoff

Posted on 2007-12-06
7
13,822 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
7 Comments
 
LVL 10

Expert Comment

by:Rogiee
Comment Utility
0
 

Author Comment

by:enosuna
Comment Utility
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:farhankazi
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 30

Accepted Solution

by:
SteveGTR earned 500 total points
Comment Utility
Could always do this:
rd /s /q "%temp%"

mkdir "%temp%"

Open in new window

0
 

Author Comment

by:enosuna
Comment Utility
how would I add the script the group policy??
0
 
LVL 30

Expert Comment

by:SteveGTR
Comment Utility
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 19

Expert Comment

by:compdigit44
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

7 Experts available now in Live!

Get 1:1 Help Now