Multiple Versions installed 7-Zip 64-bit: Remove old versions
1 Votes |
Description
Remove old versions of 7-zip 64-bit.
Removes versions older than the latest installed version, including EXE and MSI versions.
Property Details
20665 | |
Alpha - Code that was just developed | |
Multiple Versions installed 7-Zip 64-bit: Remove old versions | |
Critical | |
5/18/2016 12:00:00 AM | |
7zip, 7z, 7-zip, 7 zip, multiple version, multiple versions, x64, 64-bit, remove, remove old | |
BrianCanFixIT on 5/18/2016 9:20:29 AM | |
BrianCanFixIT on 5/18/2016 9:49:14 AM | |
9911 Views / 85 Downloads | |
![]() ![]() ![]() ![]() ![]() |
Relevance
Actions
Action 1 (default)
Action Link Click
here to deploy this action.
Script Type
BigFix Action Script
// Find the Max Version EXE and MSI
parameter "MaxVersion" = "{maximum of unique values of ((values "DisplayVersion" of keys whose (value "DisplayName" of it as string as lowercase contains "7-zip") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registry)) as string as version)}"
// Remove the 64-bit EXE version
if {exists key whose (value "DisplayName" of it as string as lowercase contains "7-zip" AND value "DisplayVersion" of it as string as version < parameter "MaxVersion" AND value "UninstallString" of it as string as lowercase contains "uninstall") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registry)}
waithidden {value "UninstallString" of key whose (value "DisplayName" of it as string as lowercase contains "7-zip" AND value "DisplayVersion" of it as string as version < parameter "MaxVersion" AND value "UninstallString" of it as string as lowercase contains "uninstall") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registry)} /S
endif
// Remove old 64-bit MSI versions
if {exists key whose (value "DisplayName" of it as string as lowercase contains "7-zip" AND value "DisplayVersion" of it as string as version < parameter "MaxVersion" AND name of it starts with "{") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registry)}
delete __createfile
delete uninstall.bat
createfile until _end_
{ concatenations "%0d%0a" of ((pathname of system folder & "\msiexec.exe /X ") & (preceding text of last "}}" of it) & "}} /quiet /norestart") of names of keys whose (value "DisplayName" of it as string as lowercase contains "7-zip" AND value "DisplayVersion" of it as string as version < parameter "MaxVersion" AND name of it starts with "{") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registry) }
_end_
move __createfile uninstall.bat
waithidden uninstall.bat
endif
Success Criteria
This action will be considered successful when the applicability relevance evaluates to false.
Sharing
Social Media: |
Comments
![]() |
|
As of now its only looking for default installs, but in some case user have installed it on other drives & copied folder in different locations, so can we include such area to search & run uninstaller from there too or remove the folder. |
![]() |
|
Found a bug, please do not use yet as the exe uninstall will remove the new version too. :( |