Solved

Ccleaner is not working using shutdown script in GPO

Posted on 2014-09-11
4
438 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
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…
Suggested Courses

622 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