I have been working on a vbs script silent disk cleanup. I cant get it completely silent. I have a good silent defrag script that works but Im having trouble with the cleanmgr.exe, I really want a vbs not a bat file if possible. Anybody out there doing this or trying? Let me know.
13 Spice ups
I have a one liner that runs via scheduled tasks that does the trick. Haven’t been using it for a long time but I am sure that I can track it down. It was always silent for us. Not VBS, though, just a one liner.
Can you post the line and let me play with it. I can use a script to load it into my users scheduled tasks.
You can do the cleanmgr.exe /sageset :1 and select the options you want and then setup a scheduled task for the following command: cleanmgr.exe /sagerun :1.
Thats what I use for my PC’s.
Thanks Mike, I was just about to go dig that out but now that I see that, that is exactly what we did. Very easy to use.
I have a lot of computers to implement this on. When you save those options it goes to your local registry right. Im trying to push this thing out to my domain via group policy. I am going to have my logon copy a file into thier hard drive and setup a scheduled task at the same time. When the task runs it will run disk cleanup and then defrag. I have the defrag silent but I cant get the disk cleanup silent, its automated but still shows the cleanup box.
How about using CCleaner with the /auto switch?
Just a thought…
Im actually looking at that software now. I worked on the script enough to know that you probably cant get cleanmgr completely silent so I will probably go another route. Microsoft should look into this because disk cleanup management is very important on a large lan. Especially when you dont want to go to every workstation and run utilities. Im of the opinion that every thing should have the ability to be automated. It frees up my time to work on more projects. Instead I have to spend hours on little ole disk cleanup.
1 Spice up
There is a way to accomplish this. Do cleanmgr.exe /sageset:1 to set your options and clikc OK to save the options, then open a notepad and type cleanmgr.exe /sagerun:1 and save it as .bat or .cmd file. Now specify the file path you just created in GPO to run either at user login or logoff or even both. That’s it!! I’m using this at my work for most of the users and it works great!!! Hope this helps you.
Hi All,
How to implement a Script or .bat file via a Group policy to all the desktop\laptops assets in First login.
The Script.bat file should delete prefetch,%temp%,temp,temporary internet files,Active Setup Temp Folders
’ Content Indexer Cleaner
’ Downloaded Program Files
’ GameNewsFiles
’ GameStatisticsFiles
’ GameUpdateFiles
’ Internet Cache Files
’ Memory Dump Files
’ Microsoft Office Temp Files
’ Offline Pages Files
’ Old ChkDsk Files
’ Previous Installations
’ Recycle Bin
’ Service Pack Cleanup
’ Setup Log Files
’ System error memory dump files
’ System error minidump files
’ Temporary Files
’ Temporary Setup Files
’ Temporary Sync Files
’ Thumbnail Cache
’ Upgrade Discarded Files
’ Windows Error Reporting Archive Files
’ Windows Error Reporting Queue Files
’ Windows Error Reporting System Archive Files
’ Windows Error Reporting System Queue Files
’ Windows Upgrade Log Files and so on.
If anybody want to add some more files, please let me know.
The Script or Bat file should run Automatic from GP.
Please let me know the procedure in step by step.
Thanks & Regards,
Hrai Haran.
I created a little batch file to silently install ccleaner, add it to the path, update itself, auto clean system with default settings and then remove itself after.
REM # Silent Install CC Cleaner #
ccsetup507.exe /S
REM # Add CC Cleaner To Windows Path #
path %path%;C:\Program Files\CCleaner;C:\Program Files (x86)\CCleaner
REM # Silent Update CC Cleaner #
ccleaner.exe /update
REM # Silent Run CC Cleaner With Default Settings #
ccleaner.exe /auto
REM # Silent UnInstall CC Cleaner #
C:\Program Files\CCleaner\uninst.exe /S
C:\Program Files (x86)\CCleaner\uninst.exe /S
1 Spice up
If you wish to do a silent clean of temp files using windows cleanmgr u can do the following, please note it is not really 100% silent but does not require user intervention. Below is the snippet from another batch i created.
REM ############## Automatic Disk Clean-up ################
REM ########## Note: This window has a pop-up #############
c:\windows\system32\cleanmgr.exe /sagerun:10
better yet on the cccleaner, could you just run it from a network share?
I have this script that I run as a quick and dirty way to bring my classrooms (that are normally frozen by DeepFreeze )
Basically I just
- repeatedly run windows updates,
- update any software for that classroom only,
and then run this guy. He
- runs some of the basic scripts we use to update browsers,
- flash, adobe reader, remote agents, printer agents…
- disables a bunch of services that are set for autostart and are… not really needed,
- removes a lot of startup items that have been on and wasting processor power (tries several locations for different versions),
- removes some desktop links that had been added by windows update or just left on desktop in some old images,
- sets our antivirus, support agent, and some other services to auto start in case they’d been turned off.
- Clears browser temp files
- disables some local accounts we’ve been trying to phase out (don’t want to delete in case there is data in them, disabling makes use of that account apparent and we can move things to the new domain account)
- runs the windows experience index, if logged on at the console. It seems to skip it if through RDP. Probably to do with how the assessments run.
- clears temp files (which does require me to click “OK” when done)
- makes sure the “my comptuter” icon if on the desktop
- clears the icon cache to make the my computer appear.
Then I usually reboot and login once just so it’s had time to go through everything normally once. And freeze them back with deepfreeze to preserve the changes
oh, I forgot to post the link to my script http://pastie.org/private/p29tnb2skwl18iczctqhw
It could probably use some cleaning up, but it gets my classroom updates done a hell of a lot faster and helps them run faster too!
mshakeer
(mshakeer)
15
I want to perform this clean up to done my SCCM.
We have any command to do silently without user getting any notification.
netsvc
(Uncle Scrooge)
16
Download Microsoft’s PsExec (SysInternals).
In your script, add the following command:
Psexec -s -d Cleanmgr.exe
Cheers!