Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executing cleanmgr.exe through gpo

Status
Not open for further replies.

josh0227

MIS
May 10, 2005
66
US
Is there a way that I can execute a simple batch file from the server that runs disk cleanup at workstations, through a gpo? If so, would I just save a batch file with the simple command: cleanmgr.exe ?

Is there a way to write the batch file so that all of the temp files and misc. stuff that can be cleaned, will be cleaned out automatically without the user having to check off all of the boxes themselves? The idea here is to make this run without user interaction.

Thanks for your help.
 
A couple of minutes of research finds these 2 KB articles:

[URL unfurl="true"]http://support.microsoft.com/default.aspx?scid=kb;en-us;315246[/url]
[URL unfurl="true"]http://support.microsoft.com/?kbid=253597[/url]

The sageset switch writes to the registry keys below this one: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches

You may need to deploy this registry key to clients if you don't like the defaults.

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Thank you. Is there any way to implement this across a network to all pc's, through a gpo? Perhaps writing a batch file or something....


Thanks!
 
Sure... Configure the cleanup manager the way you want it on a source workstation (we'll assume /sageset:1). Export the registry key listed above (ie. regkey.reg). Place the registry file in the netlogon share of your server along with the script that will execute this application.

The script will have a couple of lines like:

Code:
regedit /s %0\..\regkey.reg
cleanmgr /sagerun:1

Execute this script as a logon script from GPO or from the script specified in the user account. (If you do it by GPO, make sure that you specify it in the User part of the GPO)

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Ok, I did the registry key and put it into the netlogon file. Now, I am not really sure how to create a script file. Do I just create it and save it as a .txt or .bat file? I tried it as a .bat file and applied it to a gpo, however it did not work.

Gpresult indicated that the gpo was not applied b/c it was filtered out.

what did I do wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top