I recently had an issue completely removing Adobe Flash from computers in my environment. I got the infamous “InstallAX.exe is not marked for installation” error when running the uninstall, and this blog post by pointed me in the direction that I needed to delete registry keys from HKEY_CLASSES_ROOTInstallerFeatures. Problem was that these keys were not the same for every version of Flash.
VBScripts would probably do the trick, but whenever possible I try to use Powershell istead. I found this excellent snippet of code to do exaclty what I needed, and all credit goes to user WojciechS over at the Technet forums. Remember that you need to check your execution policy on the machine before you run the script.
Try { $Keys=Get-ChildItem HKCR:Installer -Recurse -ErrorAction Stop | Get-ItemProperty -name ProductName -ErrorAction SilentlyContinue } Catch { New-PSDrive -Name HKCR -PSProvider registry -Root HKEY_CLASSES_ROOT -ErrorAction SilentlyContinue | Out-Null $Keys=Get-ChildItem HKCR:Installer -Recurse | Get-ItemProperty -name ProductName -ErrorAction SilentlyContinue } Finally { foreach ($Key in $Keys) { if ($Key.ProductName -like "*Flash*Plugin") { Remove-Item $Key.PSPath -Force -Recurse } } }
I encountered the same issue. When deploying Adobe Flash or Oracle Java the msi are calling this registry key in order to successfully install. So I delete the key and it installs successfully.
Using powershell to delete the key and then install the application.
Note: I commented out the latest version.
ps1.
#========================================================================
# Created with: SAPIEN Technologies, Inc., PowerShell Studio 2012 v3.1.35
# Created by: Corey Thomas
# Organization:
# Filename:
#========================================================================
#$latestVersion = “16”
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Set-Location HKCR:
$keys = Get-ChildItem “HKCR:installerproducts”
foreach($key in $keys){
$product = $key.getvalue(“ProductName”)
if($product -match “Adobe Flash Player”){
# Write-Host $key.name
# Write-Host $product
# Write-Host “Checking flash version”
# if($product -notmatch $latestVersion){
# Write-Host “removing $key.name”
Remove-Item -Path $key.Name -Force -Recurse}
}
Use this file and the msi in the same file share.
I used an application based deployment, script with two deployment types. WinXP/7 as a requirement and one for Win8/2012r2 (as ActiveX is built into the OS so they require a .msu file
WinXP/7
@echo off
cd
powershell.exe -ExecutionPolicy Bypass -Command “%~dp0remove_flash_installers.ps1”
msiexec /i “%~dp0install_flash_player_16_plugin.msi” /qn
msiexec /i “%dp0install_flash_player_16_active_x.msi” /qn
exit
Win8.1
@echo off
cd
powershell.exe -ExecutionPolicy Bypass -Command “%~dp0remove_flash_installers.ps1”
msiexec /i “%~dp0install_flash_player_16_plugin.msi” /qn
“%dp0Windows8.1-KB3021953-x64.msu” /quiet /norestart
exit
Just use both msi for detection method for Winxp/7
or Win8.1 use plugin msi and HKLMSOFTWAREMacromediaFlashPlayerActiveX equals “version”
Also you can either edit the msi in orca to disable autoupdate or create a Baseline configuration to modify the reg keys.
I appreciate, lead to I found exactly what I used to be looking for.
You’ve ended my four day long hunt! God Bless you man. Have a great day.
Bye
Thanks mate, very useful.