This script automates the fix for the error which I documented here –> Adobe Flash Player ‘FP_AX_MSI_Installer’ Installer Error

I am publishing this script in hopes that it may help others fix the specific problem in the link mentioned above. Please make sure that the fix documented at the above link actually applies to your situation.

I TAKE NO RESPONSIBILITY IF THIS BRAKES ANYTHING ON YOUR COMPUTER(S)! FOR ALL I KNOW YOUR COMPUTER(S) COULD START ON FIRE AFTER RUNNING THIS SCRIPT!

I wrote this to be run as a group policy computer startup script but it can also be run manually. To run it manually, it’s probably best to use the following syntax (due to the amount of output generated). If you run the script simply by double-clicking it’ll work fine, however, you’ll receive plenty of message boxes. :)

cscript Auto_FPAX_Fix.vbs

Here’s the script:

'        File: Auto_FPAX_Fix.vbs
'      Author: Gregory Strike
'     Website: www.GregoryStrike.com
'         URL: //www.gregorystrike.com/2011/08/16/adobe-flash-player-‘fp_ax_msi_installer’-installer-error-script/
'        Date: 2011-16-08
' Description: This script fixes an issue with the Adobe Flash Player installer.  The program
'              is unable to be installed or uninstalled due to an error:
'
'              Error 2753. The file 'FP_AX_MSI_INSTALLER.exe' is not marked for installation.
'
'              This script will search for the error above since the computer last started up.
'              If the error is detected the script will search the following keys for
'              'Adobe Flash Player' and remove the keys.
'
'              HKEY_CLASSES_ROOT\Installer\Products
'              HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt
'
'              This script can also be run against a computer remotely.  Simply update the
'              strComputer = "." below and replace the period with the remote computer name.
'
'              Once removed the Adobe Flash Player should be able to be reinstalled.

strComputer = "."

Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_LOCAL_MACHINE = &H80000002

Dim StartupTime, ErrorTime, AttemptFix

'Connect to WMI Service
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Connect to registry
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'Create Shell Object (Used for LOGGING Events)
Set objShell = CreateObject("WScript.Shell")

Sub DeleteSubkeys(Root, strKeyPath)
	'The .DeleteKey method does not allow keys to be deleted that have subkeys.
	'This function is recursive and allows the keys to be deleted.
	objReg.EnumKey Root, strKeyPath, arrSubkeys
	If IsArray(arrSubkeys) Then
		For Each strSubkey In arrSubkeys
		DeleteSubkeys Root, strKeyPath & "\" & strSubkey
	Next
	End If
	objReg.DeleteKey Root, strKeyPath
End Sub 

objShell.LogEvent 4, "Auto_FPAX_Fix.vbs is searching for Adobe Flash Player errors since startup."
'Determine when computer was last started.
Set colStartUps = objWMIService.ExecQuery ("SELECT * FROM Win32_NTLogEvent WHERE Logfile = 'System' AND SourceName= 'EventLog' AND EventCode = '6005'")

For Each Startup in colStartUps
		Wscript.Echo "Computer started: " & Startup.TimeGenerated
		StartupTime =  Startup.TimeGenerated
		Exit For
Next

'Search for Naughty EventLog Entries
Set colErrors = objWMIService.ExecQuery ("SELECT * FROM Win32_NTLogEvent WHERE Logfile = 'Application' AND SourceName= 'MsiInstaller' AND EventCode = '10005' AND TimeGenerated > '" & StartupTime & "'")

AttemptFix = False
If colErrors.Count < 1 Then
	'Count was 0 and the Event was not found.
	WScript.Echo "FP_AX_MSI_Installer error did not occur since " & StartupTime & "."
	objShell.LogEvent 4, "Auto_FPAX_Fix.vbs did not find any problems."
	WScript.Quit()
Else
	'An Error was found.
	For Each EventError in colErrors
		If InStr(1, EventError.Message, "FP_AX_MSI_INSTALLER.exe") > 0 Then
		'Our specific error was found.
		ErrorTime = EventError.TimeGenerated
		WScript.Echo "WARNING: FP_AX_MSI_Installer error occured at " & ErrorTime & "."
		objShell.LogEvent 2, "WARNING: Auto_FPAX_Fix.vbs found FP_AX_MSI_Installer error at " & ErrorTime & ".  Initiating Autofix..."
		AttemptFix = True
		End If
	Next
End If

If AttemptFix = True Then
	'Error occured.  Now we must fix it good!
	WScript.Echo
	WScript.Echo "Automatic fix in process..."

	'Get all keys under Products
	objReg.EnumKey HKEY_CLASSES_ROOT, "Installer\Products", arrProducts

	'Search for Adobe Flash Player products.
	WScript.Echo "Searching 'HKEY_CLASSES_ROOT\Installer\Products\' ..."
	For Each Product in arrProducts
		objReg.GetStringValue HKEY_CLASSES_ROOT, "Installer\Products\" & Product, "ProductName", strProductName
		If InStr(1, strProductName, "Adobe Flash Player") > 0 Then
			'Flash Player Found.  Delete Registry Key.
			WScript.Echo "'" & strProductName & "' found in '" & Product & "'."
			DeleteSubKeys HKEY_CLASSES_ROOT, "Installer\Products\" & Product
		End If
	Next

	'If Adobe Flash Player was deployed via. Group Policy.  Force reinstallation.
	WScript.Echo
	WScript.Echo "Searching 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt' ..."
	objReg.EnumKey HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt", arrGroupPolicyInstalls
	For Each Product in arrGroupPolicyInstalls
		objReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt\" & Product, "Deployment Name", strProductName
		If InStr(1, strProductName, "Adobe Flash Player") > 0 Then
			'Flash Player Found.  Delete Registry Key.
			WScript.Echo "'" & strProductName & "' found in '" & Product & "'."
			DeleteSubKeys HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt" & Product
		End If
	Next
Else
	WScript.Echo "Auto_FPAX_Fix.vbs found an MsiInstaller error but it is not the exact error.  Exiting script."
	objShell.LogEvent 2, "Auto_FPAX_Fix.vbs found an MsiInstaller error but it is not the exact error.  Exiting script."
End If

Once the script above is run, you should be able to reinstall or upgrade Adobe Flash Player.



Gregory Strike

Husband, father, IT dude & blogger wrapped up into one good looking package.