Required Files: None
Download CCleaner if not already installed, and run a cleanup task
Import-Module $env:SyncroModule # Silent Install CCleaner # http://www.piriform.com/ccleaner/download # Path for the workdir $workdir = "c:\temp\" $sixtyFourBit = Test-Path -Path "C:\Program Files (x86)" $cCleanerInstalled = Test-Path -Path "C:\Program Files\CCleaner" If ($cCleanerInstalled){ Write-Host "Installed - running the cleaner!" Start-Process -FilePath "C:\Program Files\CCleaner\CCleaner64.exe" -ArgumentList "/AUTO" } ELSE { Write-Host "Doing the installation first" # Check if work directory exists if not create it If (Test-Path -Path $workdir -PathType Container){ Write-Host "$workdir already exists" -ForegroundColor Red } ELSE { New-Item -Path $workdir -ItemType directory } # Download the installer $source = "http://download.piriform.com/ccsetup537.exe" $destination = "$workdir\ccsetup.exe" # Check if Invoke-Webrequest exists otherwise execute WebClient if (Get-Command 'Invoke-Webrequest'){ Invoke-WebRequest $source -OutFile $destination } else { $WebClient = New-Object System.Net.WebClient $webclient.DownloadFile($source, $destination) } # Start the installation Start-Process -FilePath "$workdir\ccsetup.exe" -ArgumentList "/S" Start-Sleep -s 35 Start-Process -FilePath "C:\Program Files\CCleaner\CCleaner64.exe" -ArgumentList "/AUTO" } |