CCleaner fails to install with odd errors
Posted: Tue Jan 05, 2016 1:48 pm
You are trying to install or reinstall CCleaner to agents and get script log failures.
Failures look kinda like this:
Cleaner for LabTech only works on Windows systems and PowerShell is required to download the installer package and to create the script file to execute the installer.
First Powershell command – decodes a PS1 script file to C:\Windows\LTSvc\Piriform\GetInstaller.ps1
When CMD executes as administrator you should find a new file located at C:\Windows\LTSvc\Piriform\GetInstaller.ps1. But you should first make sure that the C:\Windows\LTSvc\Piriform\ folder exists first.
If this command executes correctly the file it creates should look like this when edited.
The next powershell command that runs executes (as admin) the new ps1 file we created
This will download the CCBE installer file from Piriform and place it here C:\Windows\LTSvc\Piriform\CCInstall\ ccsetup_be.msi
Lastly we then launch the installer file like so
placing your KEY and NAME in the correct places
So it takes 2 powershell commands that are run from a standard Shell prompt (See @powershell at start of cmd). You should have powershell 3 installed but I believe 2 may work. It maybe that version 2 of Powershell and lower does not have the [System.Text.Encoding]::Unicode.GetString function and thus dies with the error you see (???????????)
Here is how to test your systems.
Open a standard DOS CMD window as an Administrator, make sure that c:\windows\LTSvc\Piriform\CCInstall folder is created then copy and paste the following cmd in to the dos window.
Hit Enter to execute
Did the command execute successfully? If so is there a file C:\windows\LTSvc\Piriform\GetInstaller.ps1
If file exists then you should be good to go. If it failed in any way then Powershell needs to be fixed or permissions to the PS1 file location prevented correct execution. If you get an error that it can’t find powershell then you should update to version 3 and verify that powershell is in the system PATH to fix issues.
I hope this helps with determining issues with CCleaner installs through the Cleaner for LabTech plugin.
Cubert
Failures look kinda like this:
Cleaner Installing CCleaner Business to System ID -> 1234........
OK...
OK...
OK......
Looking for old directory cleanup
The system cannot find the file specified.
.....
Creating working directory
The system cannot find the file specified.
.........
Writing out powershell script to download new installer
OK...
Downloading the new CCleaner installer
?????????????????????=??????????????????????????????????????Z??????????????????
???????????????????????????????????????????????????????????????????? : The
term '?????????????????????=??????????????????????????????????????Z????????????
??????????????????????????????????????????????????????????????????????????' is
not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At C:\WINDOWS\LTSvc\Piriform\GetInstaller.ps1:1 char:1
+ ?????????????????????=??????????????????????????????????????Z???????? ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (???????????????...?????????????
??:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Cleaner for LabTech only works on Windows systems and PowerShell is required to download the installer package and to create the script file to execute the installer.
First Powershell command – decodes a PS1 script file to C:\Windows\LTSvc\Piriform\GetInstaller.ps1
Code: Select all
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String('ICR1cmwgPSAiaHR0cDovL3d3dy5waXJpZm9ybS5jb20vZ28vZ2V0X2NjYmUiIA0KICR0ZW1wRGlyID0gIkM6XFdpbmRvd3NcTFRTdmNcUGlyaWZvcm1cQ0NJbnN0YWxsXCINCiBpZiAoIVtTeXN0ZW0uSU8uRGlyZWN0b3J5XTo6RXhpc3RzKCR0ZW1wRGlyKSkge1tTeXN0ZW0uSU8uRGlyZWN0b3J5XTo6Q3JlYXRlRGlyZWN0b3J5KCR0ZW1wRGlyKX0NCiAkZmlsZSA9IEpvaW4tUGF0aCAkdGVtcERpciAiY2NzZXR1cF9iZS5tc2kiDQogZnVuY3Rpb24gRG93bmxvYWQtRmlsZSB7DQogICAgcGFyYW0gKA0KICAgICAgICAgICBbc3RyaW5nXSR1cmwsDQogICAgICAgICAgIFtzdHJpbmddJGZpbGUNCiAgICAgICAgICApDQogICAgJGRvd25sb2FkZXIgPSBuZXctb2JqZWN0IFN5c3RlbS5OZXQuV2ViQ2xpZW50DQogICAgJGRvd25sb2FkZXIuUHJveHkuQ3JlZGVudGlhbHM9W1N5c3RlbS5OZXQuQ3JlZGVudGlhbENhY2hlXTo6RGVmYXVsdE5ldHdvcmtDcmVkZW50aWFsczsNCiAgICAkZG93bmxvYWRlci5Eb3dubG9hZEZpbGUoJHVybCwgJGZpbGUpDQp9DQpEb3dubG9hZC1GaWxlICR1cmwgJGZpbGU=')) > %windir%\ltsvc\Piriform\GetInstaller.ps1"
If this command executes correctly the file it creates should look like this when edited.
Code: Select all
$url = "http://www.piriform.com/go/get_ccbe"
$tempDir = "C:\Windows\LTSvc\Piriform\CCInstall\"
if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)}
$file = Join-Path $tempDir "ccsetup_be.msi"
function Download-File {
param (
[string]$url,
[string]$file
)
$downloader = new-object System.Net.WebClient
$downloader.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;
$downloader.DownloadFile($url, $file)
}
Download-File $url $file
The next powershell command that runs executes (as admin) the new ps1 file we created
Code: Select all
@powershell -NoProfile -ExecutionPolicy unrestricted -file %windir%\LTSvc\Piriform\GetInstaller.ps1
Lastly we then launch the installer file like so
Code: Select all
msiexec.exe /I "%windir%\LTSvc\Piriform\CCinstall\ccsetup_be.msi" KEY="C2YW-CJN9-XHXX-XXXX-XXXX" NAME="My Company" ALLUSERS=2 /q
So it takes 2 powershell commands that are run from a standard Shell prompt (See @powershell at start of cmd). You should have powershell 3 installed but I believe 2 may work. It maybe that version 2 of Powershell and lower does not have the [System.Text.Encoding]::Unicode.GetString function and thus dies with the error you see (???????????)
Here is how to test your systems.
Open a standard DOS CMD window as an Administrator, make sure that c:\windows\LTSvc\Piriform\CCInstall folder is created then copy and paste the following cmd in to the dos window.
Code: Select all
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String('ICR1cmwgPSAiaHR0cDovL3d3dy5waXJpZm9ybS5jb20vZ28vZ2V0X2NjYmUiIA0KICR0ZW1wRGlyID0gIkM6XFdpbmRvd3NcTFRTdmNcUGlyaWZvcm1cQ0NJbnN0YWxsXCINCiBpZiAoIVtTeXN0ZW0uSU8uRGlyZWN0b3J5XTo6RXhpc3RzKCR0ZW1wRGlyKSkge1tTeXN0ZW0uSU8uRGlyZWN0b3J5XTo6Q3JlYXRlRGlyZWN0b3J5KCR0ZW1wRGlyKX0NCiAkZmlsZSA9IEpvaW4tUGF0aCAkdGVtcERpciAiY2NzZXR1cF9iZS5tc2kiDQogZnVuY3Rpb24gRG93bmxvYWQtRmlsZSB7DQogICAgcGFyYW0gKA0KICAgICAgICAgICBbc3RyaW5nXSR1cmwsDQogICAgICAgICAgIFtzdHJpbmddJGZpbGUNCiAgICAgICAgICApDQogICAgJGRvd25sb2FkZXIgPSBuZXctb2JqZWN0IFN5c3RlbS5OZXQuV2ViQ2xpZW50DQogICAgJGRvd25sb2FkZXIuUHJveHkuQ3JlZGVudGlhbHM9W1N5c3RlbS5OZXQuQ3JlZGVudGlhbENhY2hlXTo6RGVmYXVsdE5ldHdvcmtDcmVkZW50aWFsczsNCiAgICAkZG93bmxvYWRlci5Eb3dubG9hZEZpbGUoJHVybCwgJGZpbGUpDQp9DQpEb3dubG9hZC1GaWxlICR1cmwgJGZpbGU=')) > %windir%\ltsvc\Piriform\GetInstaller.ps1"
Did the command execute successfully? If so is there a file C:\windows\LTSvc\Piriform\GetInstaller.ps1
If file exists then you should be good to go. If it failed in any way then Powershell needs to be fixed or permissions to the PS1 file location prevented correct execution. If you get an error that it can’t find powershell then you should update to version 3 and verify that powershell is in the system PATH to fix issues.
I hope this helps with determining issues with CCleaner installs through the Cleaner for LabTech plugin.
Cubert
