Uninstall Flash Player - Windows

  • 17 September 2020
  • 2 replies
  • 427 views

Userlevel 4

As you probably have already heard endlessly, Adobe Flash Player will reach end of life on December 31 2020. https://www.adobe.com/products/flashplayer/end-of-life.html


Adobe has provided an uninstaller that works fairly well to remove stand-alone installations of Flash Player. https://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html


Please note the information in RED at the top of the uninstall directions:



These instructions are NOT applicable to Flash Player included with Microsoft Edge or Internet Explorer on Windows 8 and later or with Google Chrome on all supported operating systems. Please visit the Flash Player Help page for instructions on enabling (or disabling) Flash Player in various browsers.



“Most” modern browsers have built-in Flash support. Managing that integration is not in scope for this Worklet (as that topic would better be covered on how to manage Flash per browser. It is disabled by default in most of these browsers, and can be managed with policies).


Requirement - Download the uninstall_flash_player.exe from the link above, and upload it into your Worklet.


Evaluation Code:


<#
.SYNOPSIS
Check for presence of Adobe Flash Player on the target device

.DESCRIPTION
Read 32-bit and 64-bit registry to find matching applications

Exits with 0 for compliance, 1 for Non-Compliance.
Non-Compliant devices will run Remediation Code at the Policy's next scheduled date.

.NOTES
A scriptblock is used to workaround the limitations of 32-bit powershell.exe.
This allows us to redirect the operations to a 64-bit powershell.exe and read
the 64-bit registry without .NET workarounds.

.LINK
http://www.automox.com
#>

# The ScriptBlock method used here is to allow a 32-bit agent process
# to access the 64-bit registry on 64-bit Windows. This is necessary if the application
# isn't known to be 32-bit only.


$scriptblock = {
#Define Registry Location for the 64-bit and 32-bit Uninstall keys
$uninstReg = @('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall','HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')

# Define the App Name to look for
# Look at a machine with the application installed unless you're sure the formatting of the name/version
# Specifically the DisplayName. This is what you see in Add/Remove Programs. This doesn't have to be exact.
# Default behavior uses -match which is essentially "DisplayName contains VLC"
##################
$appName = 'Adobe Flash Player'
##################

# Get all entries that match our criteria. DisplayName matches $appname
$installed = @(Get-ChildItem $uninstReg -ErrorAction SilentlyContinue | Get-ItemProperty | Where-Object { ($_.DisplayName -match $appName) })

# If any matches were present, $installed will be populated. If none, then $installed is NULL and this IF statement will be false.
# The return value here is what the ScriptBlock will send back to us after we run it.
# 1 for Non-Compliant, 0 for Compliant
if ($installed) {
return 1
} else { return 0 }
}


$exitCode = & "$env:SystemRoot\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptblock
Exit $exitCode

Remediation Code:


# REQUIRES -Version 2.0
<#
.SYNOPSIS
This script allows an admin to uninstall Adobe Flash Player via Automox for Windows Devices
.DESCRIPTION
This script uninstalls Adobe Flash Player add ons and plugins on Windows. It will not uninstall the built-in
flash players in IE, Edge, or Chromium browsers as defined by Adobe

This script may not work on all systems. Modify to fit your needs

PLEASE NOTE THE FOLLOWING
1) This script assumes you have downloaded the uninstall_flash_player.exe file from https://fpdownload.macromedia.com/get/flashplayer/current/support/uninstall_flash_player.exe
and uploaded the file within your Worklet.
2) The Flash add-in\plugin will remain active if a linked browser is open. Removal will complete once the browser(s) is closed or the device is restarted.
.NOTES
File Name :Adobe_FlashPlayerUninstall_Rem.ps1
Author :Automox
Prerequisite :PowerShell V2 over win7 and upper
.LINK
http://www.automox.com
https://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html
#>

#Handle Exit Codes:
trap { $host.ui.WriteErrorLine($_.Exception); exit 90 }

function Adobe_FlashPlayerUninstall_Rem {

<#
.SYNOPSIS
This function allows Automox to Uninstall Adobe Flash Player plug-ins and add-ons for Windows.
.DESCRIPTION

.EXAMPLE
Adobe_FlashPlayerUninstall_Rem
.NOTES
#>

#############Change the settings in this block#######################
$fileName = 'uninstall_flash_player.exe'
$arg = '-uninstall'
#####################################################################

# Uninstall
Try {$process = Start-Process -FilePath "$fileName" -ArgumentList "$arg" -Wait -PassThru -ErrorAction Stop
Write-Output "Adobe Flash Player Uninstall Finished...`n"
exit 0
}
Catch { $Exception = $error[0].Exception.Message + "`nAt Line " + $error[0].InvocationInfo.ScriptLineNumber
Write-Output $Exception
exit 90
}
}
Adobe_FlashPlayerUninstall_Rem

2 replies

Userlevel 3

Thanks David it works well for me.


Is there a way to add in there to remove the leftover files in ‘C:\Windows\system32\Macromed\Flash’?

Userlevel 4

I believe that is the Microsoft default support for Flash. The uninstaller from Adobe will not be able to do it, but Microsoft will be providing a patch to uninstall native support from Windows. Right now the patch is only available through the Microsoft Update Catalog, and will become available through Windows Update/WSUS in early 2021. Take a look at the article for more detail: https://support.microsoft.com/en-us/help/4577586/update-for-removal-of-adobe-flash-player

Reply