msiexec command for uninstalling all versions of WinZip
I need to uninstall all versions of WinZip on a lot of computers.
I'm looking for a msiexec command to uninstall all versions or commands for each versions.
So far I have a command just for version 9.0 - "msiexec /x {345A4F96-3451-4622-B9CE-20ADDFDBFC80} /qn /norestart"
Thanks.
Answers (2)
Not perfect, the GUID string replacement can be improved and some other small things, but this powershell script should work. It goes through everything registered in Add/Remove and uninstalls it based on it's uninstallstring GUID. It also checks if the uninstallation failed.
Only works with MSI's and i take no responsibility for what might happen if you use this :P
It MUST run in Powershell x86 if you're using a 64bit system. SCCM launches powershell x86 automatically if you call powershell.exe in the program.
function checkExit([int]$i)
{
if (($i -ne "0") -and ($i -ne "3010"))
{
[Environment]::Exit($i)
}
}
$MSISwitch = "/qn"
$OS = Get-WmiObject -Class Win32_OperatingSystem
if ($OS.OSArchitecture -eq "64-bit")
{
$Arch = "x64"
set-alias ps64 "$env:windir\sysnative\WindowsPowerShell\v1.0\powershell.exe"
$installedsoftware64 = ps64{Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object Publisher, DisplayName, DisplayVersion, UninstallString}
$installedsoftware32 = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object Publisher, DisplayName, DisplayVersion, UninstallString
$installedsoftware = $installedsoftware32 + $installedsoftware64
}
else
{
$Arch = "x86"
$installedsoftware = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object Publisher, DisplayName, DisplayVersion, UninstallString
}
Foreach ($Application in $InstalledSoftware)
{
If ($Application.Displayname -like "*WinZip*")
{
$UninstGUID = ($_.UninstallString -replace ".*{", "") -replace "}.*", ""
$Uninstall = start-process -filepath "msiexec.exe" -argumentlist "/x {$UninstGUID} ", $msiswitch -passthru -wait
checkExit($Uninstall.ExitCode)
Remove-Variable -name "Uninstall","UninstGUID"
}
}