I am a longtime fan of CCleaner (former CrapCleaner). There is a "free" and a paid version. One difference between free and paid is an automated update of the application. In the newer versions there is an auto update in the free version, but that will show you nag screens.
The next Powershell script checks for a new version on the CCleaner website and when a newer version is available, it will download and install. You run the script manually or by Scheduled Task.
$ccleanserVersion = Get-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -eq CCleaner | Select -ExpandProperty "DisplayVersion"
write-host "*** Currently installed version: $ccleanserVersion"
$ver = $ccleanserVersion.replace(".","")
$latestVersion = Invoke-WebRequest -UseBasicParsing "https://www.ccleaner.com/ccleaner/download/standard" | Select -ExpandProperty "RawContent"
$versionMatch = $latestVersion -Match "https://download.ccleaner.com/ccsetup$ver.exe"
if (!$versionMatch) {
write-host "*** Download and install new CCleaner app..."
$latestVersion = $latestVersion -Match "https://download.ccleaner.com/ccsetup\d{3}.exe"
$url = $Matches[0]
$intallerFile = "c:\temp\ccsetup.exe"
Import-Module BitsTransfer
Start-BitsTransfer -Source $url -Destination $intallerFile
write-Output "*** Installing CCleaner..."
& "C:\Windows\system32\cmd.exe" "/c" "start" "/wait" "$intallerFile" "/S"
$ccleanserVersion = Get-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -eq CCleaner | Select -ExpandProperty "DisplayVersion"
write-host "*** New version: $ccleanserVersion"
}
ELSE
{
write-Output "*** No newer version available."
}
The update looks like this: