Solved

Ccleaner is not working using shutdown script in GPO

Posted on 2014-09-11
4
394 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
  • 2
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Gabriel Clifton earned 500 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

Want to promote your upcoming event?

Are you going to an event? Are you going to be exhibiting at a tradeshow? Talking at a conference? Using a promotional banner in your email signature ensures that your organization’s most important contacts stay in the know and can potentially spread the word about the event.

Join & Write a Comment

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.

758 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

20 Experts available now in Live!

Get 1:1 Help Now