We have a few computer classes that get slower and slower every day practically. We do maintenance on those computer from time to time, like defragging and cleaning the crap out. Defragging is ok, because it works on whole disk, but cleaning the shit is a bit of a problem to do it generally. Since our computers all are connected to the domain, each user connecting to a computer gets his profile created, and all the temp shit is put in there.
I thought of making a scheduled task to run for every student that logs on, but it proved to be a bit tricky for domain users. Eventually I was able to make a batch file to do it correctly.
@echo off
REM Script that silently installs CCleaner from a remote location and schedules a task to run it for every user that logs in
ECHO.
ECHO * Installing CCleaner with Default options
\\remotelocation\ccsetup.exe /S
ECHO * Adding a CCleaner task
schtasks /create /f /ru Users /sc onlogon /tn CCleaner /tr "\"%programfiles%\CCleaner\CCleaner.exe\" /auto"
ECHO.
pause
The script is simple as you can see. Here's a little explanation:
- /f - force create a task. Means overwrite if it exists.
- /ru Users - run as a user. As I understand you can specify a single user or a User group for which this task would apply. Since all our students are part of Users group, this will work for me.