Multiple Versions installed 7-Zip 64-bit: Remove old versions
Log In or Register to download the BES file, and more.

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

ID20665
StatusAlpha - Code that was just developed
TitleMultiple Versions installed 7-Zip 64-bit: Remove old versions
Source SeverityCritical
Source Release Date5/18/2016 12:00:00 AM
Keywords7zip, 7z, 7-zip, 7 zip, multiple version, multiple versions, x64, 64-bit, remove, remove old
Added by on 5/18/2016 9:20:29 AM
Last Modified by on 5/18/2016 9:49:14 AM
Counters 4634 Views / 41 Downloads
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 0 ratings. ** Log In or Register to add your rating.

Relevance

isWindows (Relevance 1172)
Used in 1113 fixlets and 524 analyses   * Results in a true/false
Show indented relevance
windows of operating system
Used in 1 fixlet   * Results in a true/false
Show indented relevance
(number 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) > 1 )

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:
Share this page on Yammer

Comments

Log In or Register to leave comments!
Vk.khurava -
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.
BrianCanFixIT -
Found a bug, please do not use yet as the exe uninstall will remove the new version too. :(