?
Solved

Ccleaner is not working using shutdown script in GPO

Posted on 2014-09-11
4
Medium Priority
?
451 Views
Last Modified: 2014-09-11
I created a script to run CCleaner during the shutdown/restart process of the PCs. The script works fine when I launch it manually in a PC (The computer is member of the OU in AD where the GPO is linked to) under a user’s profile, but does not show any sign of running Ccleaner during the shutdown/restart process(I still see the recycle bin full).
In order to troubleshoot the issue I added some lines in the script that will create a file (shutdown.log) and add comments to it. See the script bellow:
@ECHO OFF
:: Find Windows version x86 or x64

echo %date% %time%: Shutdown script starting> c:\shutdown.log
if exist "%ProgramFiles(x86)%" GOTO 64bit
pushd \\server-intdb\GeneralRepository\PortableCCleaner4_10\>> c:\shutdown.log 2>&1
CCleaner.exe /AUTO>> c:\shutdown.log 2>&1
popd
echo %date% %time%: Shutdown script 32bit ended>> c:\shutdown.log
GOTO END
:64bit
pushd \\server-intdb\GeneralRepository\PortableCCleaner4_10\>> c:\shutdown.log 2>&1
CCleaner64.exe /AUTO>> c:\shutdown.log 2>&1
popd
echo %date% %time%: Shutdown script 64bit ended>> c:\shutdown.log
:END

Open in new window

After the reboot process I can see that the shutdown.log file was created and two lines were added to it:
10/09/2014 16:36:40.01: Shutdown script starting
10/09/2014 16:36:45.45: Shutdown script 32bit ended

Which means that the shutdown script is running, but I cannot see any indication that Ccleaner was ran.
Now, is my understanding that shutdown scripts are running as the user LOCAL SYSTEM, which by default doesn't have access to user profiles. Question:
1-      Any suggestion how can I run the script and perform the cleanup in the user’s profile?
0
Comment
Question by:Hotspex
[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
  • 2
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Gabriel Clifton earned 2000 total points
ID: 40317270
You could make this a logoff script which would be users profile. CCleaner also has a pro version which has all users cleanup.
0
 

Author Comment

by:Hotspex
ID: 40317306
The restart process is caused by a third party app. (external). Will the logoff script work in that case too? I'll test it and get back to you
0
 

Author Comment

by:Hotspex
ID: 40317693
Thanks. It works as LOGOFF script.
0
 
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 40317818
No problem, glad to help.
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

719 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