Download and Install CCleaner

Please use the script to download CCleaner executable file to specific folder and get installed on your target machine

import urllib
import os

def main(Path, URL='http://download.piriform.com/ccsetup523.exe', sCMD='/S'):
    if os.path.exists(Path):
        fn = URL.split('/')[-1]
        fp = os.path.join(Path, fn)
        try:
            with open(fp, 'wb') as f:
                try:
                    f.write(urllib.urlopen(URL).read())
                    print fp
                except Exception as e:
                    print e
        except Exception as e:
            print e
        try:
            os.popen(fp+' '+sCMD).read()
            return 'Great! Successfully Installed'
        except Exception as e:
            return e
    else:
        return 'No path: '+Path+' is exist'


print main('C:\\Users\\Prime\\Downloads')

Sample Output:

Download and Install CCleaner.PNG

Hi @phcsolutions,

Thanks for the information, we will keep only the second one https://forum.mspconsortium.com/forum/script-library/8752-check-application-installed-if-not-download-and-install-it on the forum.

But on using the second script,
Please update the variable FileName=‘ccsetup523’ without any extension on the script

Please let me know if there any more assistance requires from me?

Thank you.