Ccleaner

Tagged: 

This topic contains 13 replies, has 6 voices, and was last updated by  David Flores 5 days, 18 hours ago.

  • Author
    Posts
  • #78659

    Rocky Ramirez
    Participant

    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

  • #78662

    Don Jones
    Keymaster

    You mean, Task Scheduler?

  • #78664

    Rocky Ramirez
    Participant

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

  • #78665

    Rocky Ramirez
    Participant

    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?

  • #78682

    Ivan
    Participant

    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

  • #78685

    Rocky Ramirez
    Participant

    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

  • #78691

    Ivan
    Participant

    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.

  • #78746

    Chris Bakker
    Participant

    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

  • #80006

    Rocky Ramirez
    Participant

    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"}

    }

    • #80197

      David Flores
      Participant

      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.

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

    • #80249

      Rocky Ramirez
      Participant

      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.

    • #80275

      David Flores
      Participant

      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.

  • #80153

    Rick
    Participant

    CCleaner was recently hacked so I'd be cautious of just downloading and installing it.
    CCleaner hack affects 2.27 million computers

    • #80155

      Rocky Ramirez
      Participant

      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.

You must be logged in to reply to this topic.