# Ccleaner

**URL:** <https://forums.powershell.org/t/ccleaner/9281>\
**Category:** PowerShell Help\
**Created:** [September 1, 2017, 9:38am UTC](https://forums.powershell.org/t/ccleaner/9281 "2017-09-01T09:38:03Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![rockyr](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rockyr](https://forums.powershell.org/u/rockyr)\
**Post date:** [September 1, 2017, 9:38am UTC](https://forums.powershell.org/t/ccleaner/9281/1 "2017-09-01T09:38:03Z")

</div>

Hey Everyone,

I am new to Powershell somewhat. Anyone have codes to download Ccleaner onto a computer automatically and run lets say once a month, or week silently in the background?

Thanks

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [September 1, 2017, 9:38am UTC](https://forums.powershell.org/t/ccleaner/9281/2 "2017-09-01T09:38:46Z")

</div>

You mean, Task Scheduler?

---

<div class="post-metadata">

**Author:** ![rockyr](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rockyr](https://forums.powershell.org/u/rockyr)\
**Post date:** [September 1, 2017, 9:40am UTC](https://forums.powershell.org/t/ccleaner/9281/3 "2017-09-01T09:40:01Z")

</div>

I know how to do that, but I wanted to see if I can run Ccleaner automatically with a PS script.

---

<div class="post-metadata">

**Author:** ![rockyr](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rockyr](https://forums.powershell.org/u/rockyr)\
**Post date:** [September 1, 2017, 9:47am UTC](https://forums.powershell.org/t/ccleaner/9281/4 "2017-09-01T09:47:42Z")

</div>

I have around 50 users I am working with so I’d rather not push TS out to all of them individually.

Anyone know of a CC script to run in background?

---

<div class="post-metadata">

**Author:** ![nj-dude](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@nj-dude](https://forums.powershell.org/u/nj-dude)\
**Post date:** [September 1, 2017, 1:48pm UTC](https://forums.powershell.org/t/ccleaner/9281/5 "2017-09-01T13:48:08Z")

</div>

Like Don mentioned above, the answer is Task Scheduler.

My understanding is, you want to:

1- Download and install CCleaner  
2- Run CCleaner

Well, the download and install can be done with a PS Script, but running it every month, that’s a job for Task Scheduler.

You can find info about [CCleaner command line here](https://www.piriform.com/docs/ccleaner/advanced-usage/command-line-parameters)

---

<div class="post-metadata">

**Author:** ![rockyr](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rockyr](https://forums.powershell.org/u/rockyr)\
**Post date:** [September 1, 2017, 3:16pm UTC](https://forums.powershell.org/t/ccleaner/9281/6 "2017-09-01T15:16:26Z")

</div>

This is great for deploying to 1 or 2 users, but what about 50+?

There has to be an invoke-command script for multiple installs.

Rocky

---

<div class="post-metadata">

**Author:** ![nj-dude](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@nj-dude](https://forums.powershell.org/u/nj-dude)\
**Post date:** [September 1, 2017, 4:37pm UTC](https://forums.powershell.org/t/ccleaner/9281/7 "2017-09-01T16:37:01Z")

</div>

What difference 2, 50 or 500 makes? an invoke-command will be needed.

It seems you need to read a little bit more about PowerShell Remoting.

---

<div class="post-metadata">

**Author:** ![chris-bakker](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/chris-bakker/32/6356_2.png) [@chris-bakker](https://forums.powershell.org/u/chris-bakker)\
**Post date:** [September 4, 2017, 6:02am UTC](https://forums.powershell.org/t/ccleaner/9281/8 "2017-09-04T06:02:18Z")

</div>

Just to clarify want you want/can do:

Powershell can do an invoke-command for you (loop through all the pc you want/need)  
Use it to start the installation:

ccsetup.exe /S

After that you need to create a scheduled task (that can be done in powershell) if you want it to run daily:

CCleaner.exe /AUTO

You can create

---

<div class="post-metadata">

**Author:** ![rockyr](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rockyr](https://forums.powershell.org/u/rockyr)\
**Post date:** [September 18, 2017, 4:24pm UTC](https://forums.powershell.org/t/ccleaner/9281/9 "2017-09-18T16:24:58Z")

</div>

Hey Everyone,

I made some progress but I am still getting “Access is denied” error codes coming back from computers. Anyone have suggestions? The underlines have script in them I have just removed for security purposes.

Rocky

foreach ($pc in (get-adcomputer -searchbase “OU=Laptops,OU=Computers,OU=**_, OU=NA, OU=Regions, DC=_, DC=_, DC=" -filter \*|where{$_.enabled}).Name) {  
$pc  
invoke-command -ComputerName $pc -scriptblock {Start-Process -FilePath "\**\_\_\_\temp$\CC\CCleaner64.exe” -ArgumentList “/CLEANER /AUTO”}

}

---

<div class="post-metadata">

**Author:** ![worlock](https://avatars.discourse-cdn.com/v4/letter/w/c77e96/32.png) [@worlock](https://forums.powershell.org/u/worlock)\
**Post date:** [September 19, 2017, 12:26pm UTC](https://forums.powershell.org/t/ccleaner/9281/10 "2017-09-19T12:26:22Z")

</div>

CCleaner was recently hacked so I’d be cautious of just downloading and installing it.  
[CCleaner hack affects 2.27 million computers](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&cad=rja&uact=8&ved=0ahUKEwij6sv257HWAhUEw4MKHUQaCEMQFgg-MAQ&url=https%3A%2F%2Fwww.cnet.com%2Fhow-to%2Fccleaner-was-hacked-heres-what-to-do-next%2F&usg=AFQjCNHekueusBjcJe7eY8zugd0um2zaLg)

---

<div class="post-metadata">

**Author:** ![rockyr](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rockyr](https://forums.powershell.org/u/rockyr)\
**Post date:** [September 19, 2017, 12:45pm UTC](https://forums.powershell.org/t/ccleaner/9281/11 "2017-09-19T12:45:44Z")

</div>

The versions that were affected are CCleaner v5.33.6162 or CCleaner Cloud v1.07.3191 for 32-bit Windows PCs.  
If you update to latest version you will be fine.

---

<div class="post-metadata">

**Author:** ![dsf3g](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@dsf3g](https://forums.powershell.org/u/dsf3g)\
**Post date:** [September 19, 2017, 7:26pm UTC](https://forums.powershell.org/t/ccleaner/9281/12 "2017-09-19T19:26:02Z")

</div>

Just a theory, but I know that PowerShell remoting won’t let you do multiple hops. That is, you can’t remote to one machine and then remote and execute code on a third machine. You’ll get “access denied” errors. The fact that you’re remoting to one machine and trying to launch an executable that resides a network share may be the problem.

> **[Enabling Multihop Remoting](https://devblogs.microsoft.com/scripting/enabling-multihop-remoting/)**
>
> Summary: Microsoft PowerShell MVPs, Don Jones and Jeffery Hicks, discuss how to enable multihop remoting in Windows PowerShell 3.0. Microsoft Scripting Guy, Ed Wilson, is here. Tonight is our Windows PowerShell User Group meeting in Charlotte, NC, I...

Again, this is just a theory. I could be completely wrong on this.

---

<div class="post-metadata">

**Author:** ![rockyr](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rockyr](https://forums.powershell.org/u/rockyr)\
**Post date:** [September 20, 2017, 9:05am UTC](https://forums.powershell.org/t/ccleaner/9281/13 "2017-09-20T09:05:54Z")

</div>

This is not correct in our case. We aren’t hopping from one then to another. You are running on one, closing, running on the next. One at a time.

---

<div class="post-metadata">

**Author:** ![dsf3g](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@dsf3g](https://forums.powershell.org/u/dsf3g)\
**Post date:** [September 20, 2017, 12:42pm UTC](https://forums.powershell.org/t/ccleaner/9281/14 "2017-09-20T12:42:30Z")

</div>

The second hop isn’t when you move to the next computer. It’s when you try to run the executable that’s hosted on a remote network share. To test my theory copy the CCleaner.exe executable to a local directory on a target machine “C:\Temp” for instance, then modify your script to look for it there. If the script runs without issue then that suggests it’s a double-hop issue. If you still get “Access Denied” then it’s something else.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:37pm UTC](https://forums.powershell.org/t/ccleaner/9281/15 "2024-05-16T20:37:29Z")

</div>


