Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#Requires -Version 2
function Get-AdobeFlashMsi {
param (
$Destination = $(Join-Path -Path $env:USERPROFILE -ChildPath 'Downloads' ),
$FlashActiveX = '',
$FlashPlugin = '',
$FlashPpapi = '',
$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
You can’t perform that action at this time.