Skip to content

Instantly share code, notes, and snippets.

@jasonadsit
Last active May 1, 2021 15:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jasonadsit/c77340fe385fe953f9c54436b926cf83 to your computer and use it in GitHub Desktop.
Save jasonadsit/c77340fe385fe953f9c54436b926cf83 to your computer and use it in GitHub Desktop.
Get-AdobeFlashMsi.ps1
#Requires -Version 2
function Get-AdobeFlashMsi {
[CmdletBinding()]
param (
[string]
$Destination = $(Join-Path -Path $env:USERPROFILE -ChildPath 'Downloads' ),
[string]
$FlashActiveX = 'https://www.adobe.com/etc/adc/token/generation.installerlink.json?href=https%3A%2F%2Ffpdownload.macromedia.com%2Fget%2Fflashplayer%2Fdistyfp%2Fcurrent%2Fwin%2Finstall_flash_player_32_active_x.msi',
[string]
$FlashPlugin = 'https://www.adobe.com/etc/adc/token/generation.installerlink.json?href=https%3A%2F%2Ffpdownload.macromedia.com%2Fget%2Fflashplayer%2Fdistyfp%2Fcurrent%2Fwin%2Finstall_flash_player_32_plugin.msi',
[string]
$FlashPpapi = 'https://www.adobe.com/etc/adc/token/generation.installerlink.json?href=https%3A%2F%2Ffpdownload.macromedia.com%2Fget%2Fflashplayer%2Fdistyfp%2Fcurrent%2Fwin%2Finstall_flash_player_32_ppapi.msi',
[string[]]
$FlashUrls = @($FlashActiveX,$FlashPlugin,$FlashPpapi)
) #param
begin {
Add-Type -AssemblyName System.Web.Extensions
Write-Verbose -Message "Setting TLS 1.2 as the .NET SecurityProtocol for the download."
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
} #begin
process {
$FlashUrls | ForEach-Object {
Write-Verbose -Message "Getting download token from Adobe"
$JsonResponse = (New-Object System.Net.WebClient).DownloadString($_)
Write-Verbose -Message "Extract the URL string from the JSON response"
$Url = (New-Object System.Web.Script.Serialization.JavaScriptSerializer).DeserializeObject($JsonResponse).Values
Write-Verbose -Message "Determining filename"
$FileName = $($Url.Split('?')[0].Split('/')[-1])
$FilePath = Join-Path -Path $Destination -ChildPath $FileName
Write-Verbose -Message "Downloading $FileName"
(New-Object System.Net.WebClient).DownloadFile("$Url","$FilePath")
} #ForEach
} #process
} #function Get-AdobeFlashMsi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment