Have you ever needed to clean someone’s PC but you wanted to do it from your computer instead of theirs? Here’s how you can remotely execute CCleaner on any Windows PC you have network access to.
Running CCleaner on a Remote Machine
Head over to the Piriform website and grab a copy of the portable version of CCleaner.
Once the download has completed, extract the archive.
Now we need to create a self-extracting archive–this is going to help us automatically execute CCleaner when it is copied to the remote machine. Our tool of choice is WinRAR, although other self-extracting archive builders may work. To do this select all the extracted files and add them to a new archive.
Note: WinRAR is not actually free, however, there is a 40 day trial available which is more than sufficient for this article.
The first thing we need to do is tell WinRAR that we are building a self-extracting archive.
Then switch over to the Advanced tab and click on the SFX options button.
Now you will want to head over to the Setup tab, here we need to specify what we want to run when the archive has been extracted. We are going to opt to use the CCleaner binary since we have both x86 and x64 PCs on our network, however if you only have x64 PCs you might want to use the CCleaner64 binary, but whichever you choose don’t forget to include the /auto switch.
Next head over to the Modes tab, here you will need to check the Unpack to temporary folder checkbox as well as set the Silent mode to Hide all.
Finally change to the Update tab and set the Overwrite mode to Overwrite all files.
Now click OK and then OK again to build the archive. Once the archive is built you can test it by running it, you should see the CCleaner icon appear in the System Tray area.
Now that we are able to automatically execute CCleaner we need a method of copying it the target computer as well as executing it. Luckily for us PSExec does both those things. So head over to the Sysinternals Website and grab a copy of PSTools.
Once PSTools has downloaded and you have extracted it, fire up a command prompt and locate the PSExec executable.
Then go ahead and execute the following command:
PSEXEC \\Taylor-PC -c “C:\Users\Taylor\Downloads\Clean.exe” -u TaylorGibb –p Password
- \\Taylor-PC with the DNS name of the remote machine.
- The file path with the path to the file we created earlier.
- TaylorGibb with the username on the remote machine.
- Password with the password for the remote machine.
The last thing to note is that you wont actually see the process run, there is a long explanation for this which I am not going to get into, suffice to say if you remotely execute the app and then open task manager on the remote machine you WILL see the process run, just don’t look out for the icon because you will be waiting forever.
That’s all there is to it.