Files

1178 lines
49 KiB
PowerShell
Raw Permalink Normal View History

2025-08-07 00:21:58 +00:00
<#
Author: Gabe Kerntke
Date: 05-02-2024
.Synopsis
This script will check updates for:
Chrome
Firefox
Edge
Java JRE 64-bit and 32-bit
Adobe Reader 64-bit and 32-bit
Adobe Acrobat 64-bit and 32-bit
7-zip (blocked)
Notepad++ (blocked)
Keepass (blocked)
Putty
WinSCP
WinZip
Wireshark
Zoom
Cisco Webex
GoToMeeting
Amazon Corretto JDK
VMWare Tools
RingCentral msi
Foxit Reader
.Modified
2023-06-10 (GabeK) - Original script created
#>
######################
### Functions ###
######################
# Clear out older versions of downloads
function Cleanup ($readVersion, $name) {
# Set how old the file can be before getting deleted
$limit = (Get-Date).AddDays(-20)
# Delete files older than the $limit
Get-ChildItem -Path $folderName -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.LastWriteTime -lt $limit } | Remove-Item -Verbose -Force
}
#main function to download the program
function downloadProgram ($readVersion, $version, $download, $name) {
If (!(test-path -PathType container $folderName)) {
New-Item -ItemType Directory -Path $folderName
}
If ([version]$readVersion -ne [version]$version) {
Write-Host "Newer version of $folderName($version) found online!"
Invoke-WebRequest "$download" -outfile "$name"
Cleanup
}
else {
Write-Host "No newer version of $folderName found."
}
}
function Get-Chrome {
#VARIABLES
$initialURL = "https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions"
$folderName = "Chrome"
$filenamePrefix = "Chrome-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
$programVERSION = Invoke-RestMethod "$initialURL" | Select-Object -ExpandProperty versions | Select-Object -ExpandProperty version | Select-Object -First 1
$programDOWNLOAD = "https://dl.google.com/chrome/install/latest/chrome_installer.exe"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Firefox {
#VARIABLES
$initialURL = "https://product-details.mozilla.org/1.0/firefox_versions.json"
$folderName = "Firefox"
$filenamePrefix = "Firefox-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
$firefoxVersions = (Invoke-WebRequest -UseBasicParsing "$initialURL").Content | ConvertFrom-Json
$programVersionLookup = $firefoxVersions.LATEST_FIREFOX_VERSION
#more variables
$programVERSION = "$programVersionLookup"
$firefoxUrl = (Invoke-WebRequest -UseBasicParsing "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$programVersionLookup/win64/en-US/").Links.href -like "*exe*"
$programDOWNLOAD = "https://download-installer.cdn.mozilla.net$firefoxUrl"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Edge {
#VARIABLES
$initialURL = "https://edgeupdates.microsoft.com/api/products?view=enterprise"
$folderName = "Edge"
$filenamePrefix = "Edge-x64"
$filenameExtension = "msi"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
$Program = Invoke-WebRequest -UseBasicParsing "$initialURL" | ConvertFrom-Json
#more variables
$programVERSION = $Program | Where-Object { $_.Product -eq "Stable" } | Select-Object -ExpandProperty Releases | Where-Object { $_.Platform -eq "Windows" -and $_.Architecture -eq "x64" } | Sort-Object -Property ProductVersion -Descending | Select-Object -First 1 | Select-Object -ExpandProperty ProductVersion
$programDOWNLOAD = $Program | Where-Object { $_.Product -eq "Stable" } | Select-Object -ExpandProperty Releases | Where-Object { $_.Platform -eq "Windows" -and $_.Architecture -eq "x64" } | Sort-Object -Property ProductVersion -Descending | Select-Object -First 1 | Select-Object -ExpandProperty Artifacts | Select-Object -ExpandProperty Location
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Java64 {
#VARIABLES
$initialURL = "https://javadl-esd-secure.oracle.com/update/1.8.0/map-1.8.0.xml"
$folderName = "Java JRE 64bit"
$filenamePrefix = "jre-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#more variables
$mapXML = Invoke-RestMethod "$initialURL" -UserAgent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46'
#Select latest build from entries marked as 'critical'
$target = ($mapXML.'java-update-map'.mapping | Where-Object { $_.critical -eq 1 } | Select-Object -Last 1)
$params = @{
'Uri' = [string]$target.url
'ContentType' = 'application/xml'
'UserAgent' = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46'
}
$javaXml = Invoke-RestMethod @params
#substituting the 'au' (automatic update) value in the url with the desired architecture.
$javaUpdateInfo = $javaXml.'java-update'.information
$availableJreVersion = ($javaUpdateInfo | Where-Object { $_.lang -eq 'en' }).version -notmatch '^1\.0$'
$javaUpdateUrl = [string]($javaUpdateInfo.url) -replace '\-au', "-x64"
$programDOWNLOAD = $javaUpdateUrl
#finds latest version from online
$A = $javaUpdateUrl.substring(115)
$B = $A.Substring(0, $A.Length - 26)
$programVERSION = $B -replace ("U", ".")
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Java32 {
#VARIABLES
$initialURL = "https://javadl-esd-secure.oracle.com/update/1.8.0/map-1.8.0.xml"
$folderName = "Java JRE 32bit"
$filenamePrefix = "jre-x32"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#more variables
$mapXML = Invoke-RestMethod "$initialURL" -UserAgent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46'
#Select latest build from entries marked as 'critical'
$target = ($mapXML.'java-update-map'.mapping | Where-Object { $_.critical -eq 1 } | Select-Object -Last 1)
$params = @{
'Uri' = [string]$target.url
'ContentType' = 'application/xml'
'UserAgent' = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46'
}
$javaXml = Invoke-RestMethod @params
#substituting the 'au' (automatic update) value in the url with the desired architecture.
$javaUpdateInfo = $javaXml.'java-update'.information
$availableJreVersion = ($javaUpdateInfo | Where-Object { $_.lang -eq 'en' }).version -notmatch '^1\.0$'
$programDOWNLOAD = [string]($javaUpdateInfo.url) -replace '\-au', "-i586"
#finds latest version from online
$A = $programDOWNLOAD.substring(115)
$B = $A.Substring(0, $A.Length - 27)
$programVERSION = $B -replace ("U", ".")
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-AdobeReader64 {
#VARIABLES
#$initialURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#"
$folderName = "Adobe Reader update 64bit"
$filenamePrefix = "Adobe-Reader-x64"
$filenameExtension = "msp"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
# Define a script block that contains the Invoke-WebRequest command
$scriptBlock = {
(Invoke-WebRequest -UseBasicParsing -Headers @{
"accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
"accept-encoding"="gzip, deflate, br"
"accept-language"="en-GB,en;q=0.9,en-US;q=0.8"
} -Uri "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1
}
#(Invoke-WebRequest -UseBasicParsing -Headers @{"accept"="*/*"} "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1
#Start a new PowerShell background job and pass the script block to it
$job = Start-Job -ScriptBlock $scriptBlock
#Wait for the job to complete
$timeout = 30
Wait-Job $job -timeout $timeout | Out-Null
#Get the output from the job and display it
$output = Receive-Job $job
$A = $output.Substring(125)
$B = $A.Substring(0, $A.Length - 38)
$Version = $B -replace "[^\d*\.?\d*$/]" , ''
#Gets second half of URL of newest version
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'powershell.exe'
$psi.Arguments = "(Invoke-WebRequest -UseBasicParsing -Headers @{
'accept'='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
'accept-encoding'='gzip, deflate, br'
'accept-language'='en-GB,en;q=0.9,en-US;q=0.8'
} -Uri 'https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#').Links.href -like 'continuous/*' | Select-Object -First 1"
$psi.RedirectStandardOutput = $true
$psi.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($psi)
$output = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
#combines the first and second half URLs for latest version's URL
$CombinedURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/$output"
#gets link
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'powershell.exe'
$psi.Arguments = "(Invoke-WebRequest -UseBasicParsing -Headers @{
'accept'='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
'accept-encoding'='gzip, deflate, br'
'accept-language'='en-GB,en;q=0.9,en-US;q=0.8'
} -Uri '$CombinedURL').Links.href -like '*AcroRdrDCx64*' | Select-Object -First 1"
$psi.RedirectStandardOutput = $true
$psi.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($psi)
$programDOWNLOAD = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
$programVERSION = $Version
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-AdobeReader32 {
#VARIABLES
#$initialURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#"
$folderName = "Adobe Reader update 32bit"
$filenamePrefix = "Adobe-Reader-x32"
$filenameExtension = "msp"
$defaultVersion = "0.0.0.0"
###############
#findslatest version from online
# Define a script block that contains the Invoke-WebRequest command
$scriptBlock = {
(Invoke-WebRequest -UseBasicParsing -Headers @{
"accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
"accept-encoding"="gzip, deflate, br"
"accept-language"="en-GB,en;q=0.9,en-US;q=0.8"
} -Uri "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1 }
#Start a new PowerShell background job and pass the script block to it
$job = Start-Job -ScriptBlock $scriptBlock
#Wait for the job to complete
$timeout = 30
Wait-Job $job -timeout $timeout | Out-Null
#Get the output from the job and display it
$output = Receive-Job $job
$A = $output.Substring(125)
$B = $A.Substring(0, $A.Length - 38)
$Version = $B -replace "[^\d*\.?\d*$/]" , ''
#Gets second half of URL of newest version
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'powershell.exe'
$psi.Arguments = "(Invoke-WebRequest -UseBasicParsing -Headers @{
'accept'='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
'accept-encoding'='gzip, deflate, br'
'accept-language'='en-GB,en;q=0.9,en-US;q=0.8'
} -Uri 'https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#').Links.href -like 'continuous/*' | Select-Object -First 1"
$psi.RedirectStandardOutput = $true
$psi.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($psi)
$output = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
#combines the first and second half URLs for latest version's URL
$CombinedURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/$output"
#gets link
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'powershell.exe'
$psi.Arguments = "(Invoke-WebRequest -UseBasicParsing -Headers @{
'accept'='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
'accept-encoding'='gzip, deflate, br'
'accept-language'='en-GB,en;q=0.9,en-US;q=0.8'
} -Uri '$CombinedURL').Links.href -like '*AcroRdrDCUpd*' | Select-Object -First 1"
$psi.RedirectStandardOutput = $true
$psi.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($psi)
$programDOWNLOAD = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
$programVERSION = $Version
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-AdobeAcrobat64 {
#VARIABLES
#$initialURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#"
$folderName = "Adobe Acrobat update 64bit"
$filenamePrefix = "Adobe-Acrobat-x64"
$filenameExtension = "msp"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
# Define a script block that contains the Invoke-WebRequest command
$scriptBlock = {
(Invoke-WebRequest -UseBasicParsing -Headers @{
"accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
"accept-encoding"="gzip, deflate, br"
"accept-language"="en-GB,en;q=0.9,en-US;q=0.8"
} -Uri "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1 }
#Start a new PowerShell background job and pass the script block to it
$job = Start-Job -ScriptBlock $scriptBlock
#Wait for the job to complete
$timeout = 30
Wait-Job $job -timeout $timeout | Out-Null
#Get the output from the job and display it
$output = Receive-Job $job
$A = $output.Substring(125)
$B = $A.Substring(0, $A.Length - 38)
$Version = $B -replace "[^\d*\.?\d*$/]" , ''
#Gets second half of URL of newest version
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'powershell.exe'
$psi.Arguments = "(Invoke-WebRequest -UseBasicParsing -Headers @{
'accept'='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
'accept-encoding'='gzip, deflate, br'
'accept-language'='en-GB,en;q=0.9,en-US;q=0.8'
} -Uri 'https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#').Links.href -like 'continuous/*' | Select-Object -First 1"
$psi.RedirectStandardOutput = $true
$psi.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($psi)
$output = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
#combines the first and second half URLs for latest version's URL
$CombinedURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/$output"
#gets link
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'powershell.exe'
$psi.Arguments = "(Invoke-WebRequest -UseBasicParsing -Headers @{
'accept'='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
'accept-encoding'='gzip, deflate, br'
'accept-language'='en-GB,en;q=0.9,en-US;q=0.8'
} -Uri '$CombinedURL').Links.href -like '*AcrobatDCx64*' | Select-Object -First 1"
$psi.RedirectStandardOutput = $true
$psi.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($psi)
$programDOWNLOAD = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
$programVERSION = $Version
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-AdobeAcrobat32 {
#VARIABLES
#$initialURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#"
$folderName = "Adobe Acrobat update 32bit"
$filenamePrefix = "Adobe-Acrobat-x32"
$filenameExtension = "msp"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
# Define a script block that contains the Invoke-WebRequest command
$scriptBlock = {
(Invoke-WebRequest -UseBasicParsing -Headers @{
"accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
"accept-encoding"="gzip, deflate, br"
"accept-language"="en-GB,en;q=0.9,en-US;q=0.8"
} -Uri "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#").Links.outerHTML -like "*continuous/*" | Select-Object -First 2 | Select-Object -Last 1 }
#Start a new PowerShell background job and pass the script block to it
$job = Start-Job -ScriptBlock $scriptBlock
#Wait for the job to complete
$timeout = 30
Wait-Job $job -timeout $timeout | Out-Null
#Get the output from the job and display it
$output = Receive-Job $job
$A = $output.Substring(125)
$B = $A.Substring(0, $A.Length - 38)
$Version = $B -replace "[^\d*\.?\d*$/]" , ''
#Gets second half of URL of newest version
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'powershell.exe'
$psi.Arguments = "(Invoke-WebRequest -UseBasicParsing -Headers @{
'accept'='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
'accept-encoding'='gzip, deflate, br'
'accept-language'='en-GB,en;q=0.9,en-US;q=0.8'
} -Uri 'https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html#').Links.href -like 'continuous/*' | Select-Object -First 1"
$psi.RedirectStandardOutput = $true
$psi.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($psi)
$output = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
#combines the first and second half URLs for latest version's URL
$CombinedURL = "https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/$output"
#gets link
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'powershell.exe'
$psi.Arguments = "(Invoke-WebRequest -UseBasicParsing -Headers @{
'accept'='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
'accept-encoding'='gzip, deflate, br'
'accept-language'='en-GB,en;q=0.9,en-US;q=0.8'
} -Uri '$CombinedURL').Links.href -like '*AcrobatDCUpd*' | Select-Object -First 1"
$psi.RedirectStandardOutput = $true
$psi.UseShellExecute = $false
$process = [System.Diagnostics.Process]::Start($psi)
$programDOWNLOAD = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
$programVERSION = $Version
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-7zip {
#VARIABLES
$initialURL = "https://www.7-zip.org/"
$folderName = "7-zip"
$filenamePrefix = "7zip-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href | where-object { $_.EndsWith("exe") } | Select-Object -First 1
#more variables
$programVERSION = $program.substring(4, $program.Length - 12) + ".0"
$programDOWNLOAD = $initialURL + $program
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Notepad++ {
#VARIABLES
$initialURL = "https://notepad-plus-plus.org/downloads/"
$folderName = "notepad++"
$filenamePrefix = "npp-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$program = (Invoke-webRequest "$initialURL").Links.href | Where-Object { $_.ToLower().StartsWith("https") } | Select-Object -First 1
$Version = (Invoke-WebRequest "$program").Links.href | Where-Object { $_.EndsWith("exe") } | Select-Object -First 1
#more variables
$A = $Version.Substring(58)
$B = $A.Substring(0, $A.Length - 25)
$programVERSION = $B -replace "[^\d*\.?/\d*]" , '' -replace "/" , ''
$programDOWNLOAD = $programVersionLookup
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Keepass {
#VARIABLES
$initialURL = "https://keepass.info/download.html"
$folderName = "keepass"
$filenamePrefix = "Keepass-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href -like "*exe*" | Select-Object -First 1
#more variables
$str = $program
$start = 61
$len = 4
$programVERSION = $str.Substring($start, [Math]::Min(($str.Length - $start), $len))
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$programREAD = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | Sort-Object LastWriteTimeUtc -Descending | Select-Object -First 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "")
}
#calling to download function above to download program
downloadKeepass $programREADVERSION $programVERSION $programFILENAME
}
function downloadKeepass ($readVersion, $version, $name) {
If (!(test-path -PathType container $folderName)) {
New-Item -ItemType Directory -Path $folderName
}
If ($readVersion -lt $version) {
Write-Host "Newer version of $folderName($version) found online!"
Invoke-WebRequest -UserAgent "Wget" -Uri "https://sourceforge.net/projects/keepass/files/latest/download" -outfile "$name"
Cleanup
}
else {
Write-Host "No newer version of $folderName found."
}
}
function Get-Putty {
#VARIABLES
$initialURL = "https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html"
$folderName = "Putty"
$filenamePrefix = "putty-x64"
$filenameExtension = "msi"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href | Where-Object { $_.ToLower().StartsWith("https") } | Where-Object { $_.EndsWith("msi") } | Select-Object -First 1
$A = $program.Substring(58)
$B = $A.Substring(0, $A.Length - 5)
$programVERSION = $B -replace "[^\d*\.?\d*$/]" , ''
$programDOWNLOAD = $program
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-WinSCP {
#VARIABLES
$initialURL = "https://winscp.net/eng/download.php"
$folderName = "WinSCP"
$filenamePrefix = "winscp-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href | Where-Object { $_ -like ("*exe*") } | Select-Object -First 1
$A = $program.Substring(10)
$B = $A.Substring(0, $A.Length - 10)
$programVERSION = $B -replace "[^\d*\.?\d*$/]" , '' | ForEach-Object { $_.Substring(0, $_.length - 1) }
$programDOWNLOAD = (Invoke-WebRequest -UseBasicParsing "https://winscp.net$program").Links.href -like "*Setup.exe*" | Select-Object -First 1
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-WinZip {
#VARIABLES
$initialURL = "https://www.winzip.com/en/download/winzip/"
$folderName = "WinZip"
$filenamePrefix = "winzip-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href -like "*exe*" | Select-Object -First 1
$A = $program.Substring(25)
$B = $A.Substring(0, $A.Length - 4)
$C = $B -replace "[^\d*\.?/\d*]" , '' -replace "/" , ''
$programVERSION = $C + ".0"
$programDOWNLOAD = "$program"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Wireshark {
#VARIABLES
$initialURL = "https://www.wireshark.org/download.html"
$folderName = "Wireshark"
$filenamePrefix = "wireshark-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$program = (Invoke-webRequest -UseBasicParsing "$initialURL").Links.href -like "*exe*" | Select-Object -First 1
$A = $program.Substring(35) -replace "[^\d*\.?/\d*]", '' -replace "/" , ''
$programVERSION = $A.Substring(0, $A.Length - 1)
$programDOWNLOAD = "$program"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Zoom {
#VARIABLES
$initialURL = "https://zoom.us/rest/download?os=win"
$folderName = "Zoom"
$filenamePrefix = "zoom-x64"
$filenameExtension = "msi"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
$programVERSION = (Invoke-RestMethod "$initialURL").result.downloadVO.zoomX64.version
$programDOWNLOAD = "https://zoom.us/client/latest/ZoomInstallerFull.msi?archType=x64"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-ZoomPlugin {
#VARIABLES
$initialURL = "https://zoom.us/rest/download?os=win"
$folderName = "Zoom plugin"
$filenamePrefix = "zoom-plugin"
$filenameExtension = "msi"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$programVERSION = (Invoke-RestMethod "$initialURL").result.downloadVO.outlookPlugin.version
$programDOWNLOAD = "https://zoom.us/client/latest/ZoomOutlookPluginSetup.msi"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-AmazonCorretto {
#VARIABLES
$initialURL = "https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html"
$folderName = "Amazon Corretto JDK"
$filenamePrefix = "Corretto-JDK-x32"
$filenameExtension = "msi"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
$Program = (Invoke-WebRequest -UseBasicParsing "$initialURL").Links.href -like "*msi*" -like "*jdk*" -like "*x86*" | Select-Object -First 1
$request = [System.Net.WebRequest]::Create($Program)
$request.AllowAutoRedirect = $false
$response = $request.GetResponse()
$Version = If ($response.StatusCode -eq "Found") { $response.GetResponseHeader("Location") }
#more variables
$programVERSION = $Version.split("/") | Select-Object -First 4 | Select-Object -Last 1
$programDOWNLOAD = $Program
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Webex {
#VARIABLES
$initialURL = "https://help.webex.com/en-us/article/mqkve8/Webex-App-%7C-Release-notes"
$folderName = "Webex"
$filenamePrefix = "webex-x64"
$filenameExtension = "msi"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
#$program = (Invoke-WebRequest -UseBasicParsing $initialURL).Links.outerHTML | Where-Object { $_.outerHTML -like '*app versions*' } | Select-Object -ExpandProperty outerHTML | Select-Object -First 1
#Download the HTML content
$html = (New-Object System.Net.WebClient).DownloadString($initialURL)
# Split the content on ">" and "<" characters to extract the text content
$text = $html.Split([char[]]@(">", "<"), [StringSplitOptions]::RemoveEmptyEntries) | Select-Object -First 700
$Text2 = $text -like "Windows*"
# Find the start and end index of the table
#$startIndex = $text.IndexOf("Bug search tool")
#$endIndex = $text.IndexOf("The bugs that are listed in the following table describe resolved issues in these releases.")
# Extract the table rows
#$rows = $text[$startIndex..$endIndex] -like "*Windows*"
# Filter out only the rows containing version numbers
$Versions = $Text2 | Where-Object { $_ -match "\d+\.\d+\.\d+" } | ForEach-Object { $_ -replace "&#xA0;", "" }
#$Version = $program.Substring(75)
$programVERSION = $Versions -replace "[^\d*\.?/\d*]" , '' -replace "/" , ''
$programDOWNLOAD = "https://binaries.webex.com/WebexTeamsDesktop-Windows-Gold/Webex_en.msi"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-GoToMeeting {
#VARIABLES
$initialURL = "https://link.gotomeeting.com/latest-msi"
$folderName = "GoToMeeting"
$filenamePrefix = "gotomeeting-x64"
$filenameExtension = "msi"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
$request = [System.Net.WebRequest]::Create($initialURL)
$request.AllowAutoRedirect = $false
$response = $request.GetResponse()
$Program = $response.GetResponseHeader("Location")
#more variables
$A = $Program.Substring(50)
$B = $A.Substring(0, $A.Length - 52)
$programVERSION = $B -replace "[^\d*\.?/\d*]" , '' -replace "/" , ''
$programDOWNLOAD = $initialURL
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-VMwareTools {
#VARIABLES
$initialURL = "https://packages.vmware.com/tools/releases/latest/windows/x64/"
$folderName = "VMware Tools"
$filenamePrefix = "VMwareTools-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$Program = (Invoke-WebRequest -UseBasicParsing "$initialURL").links.href -like "*exe*"
$programVERSION = $Program.split("-") | Select-Object -First 3 | Select-Object -Last 1
$programDOWNLOAD = "$initialURL" + "$Program"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-RingCentral {
#VARIABLES
$initialURL = "https://support.ringcentral.com/release-notes/mvp/app/desktop-webapp.html"
$folderName = "RingCentral"
$filenamePrefix = "RingCentral-x64"
$filenameExtension = "msi"
$defaultVersion = "0.0.0"
###############
#finds latest version from online
$html = (New-Object System.Net.WebClient).DownloadString("$initialURL")
# Split the content on ">" and "<" characters to extract the text content
$text = $html.Split([char[]]@(">", "<"), [StringSplitOptions]::RemoveEmptyEntries)
$A = $text | Where-Object { $_ -like "Version*" }
$programVERSION = $A -replace "[^\d*\.?/\d*]"
$programDOWNLOAD = "https://app.ringcentral.com/download/RingCentral-x64.msi"
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
function Get-Foxit {
#VARIABLES
$initialURL = "https://www.foxit.com/pdf-reader/version-history.html"
$folderName = "Foxit PDF Reader"
$filenamePrefix = "FoxitReader-x64"
$filenameExtension = "exe"
$defaultVersion = "0.0.0.0"
###############
#finds latest version from online
# Download the HTML content
$html = (New-Object System.Net.WebClient).DownloadString("$initialURL")
# Split the content on ">" and "<" characters to extract the text content
$text = $html.Split([char[]]@(">", "<"), [StringSplitOptions]::RemoveEmptyEntries)
$A = $text | Where-Object { $_ -like "Version*" }
$programVERSION = $A -replace "[^\d*\.?/\d*]" | Select-Object -First 2 | Select-Object -Last 1
$programDOWNLOAD = "https://www.foxit.com/downloads/latest.html?product=Foxit-Reader&platform=Windows&version=&package_type=&language=English&distID="
####################################################
#verifying/comparing version already downloaded to what is online
$programFILENAME = ".\$folderName\$filenamePrefix-$programVERSION.$filenameExtension"
$GetVersions = Get-ChildItem ".\$folderName\" -name -ErrorAction SilentlyContinue | ForEach-Object { $_ -replace ("$filenamePrefix-", "") -replace (".$filenameExtension", "") }
$programREAD = $GetVersions | Sort-Object { [version] $_ } | Select-Object -Last 1
if ($programREAD.length -eq 0) {
$programREADVERSION = "$defaultVersion"
}
else {
$programREADVERSION = $programREAD
}
#calling to download function above to download program
downloadProgram $programREADVERSION $programVERSION $programDOWNLOAD $programFILENAME
###################
}
######################
### Script start ###
######################
#Use TLS 1.2 for communication
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Checks if device is a Probe by looking for EPCache folder
$EPCache = Test-Path "C:\Temp\Script Cache\"
If ($EPCache -eq $true) {
#Create 3rd Party Patches folder if doesn't exist
$PatchesFolder = Test-Path "C:\Temp\Script Cache\3rd Party Patches"
If ($PatchesFolder -eq $false) { New-Item -ItemType Directory -Path "C:\Temp\Script Cache\3rd Party Patches" }
Set-Location "C:\Temp\Script Cache\3rd Party Patches"
#Run functions
Get-Chrome
Get-Firefox
Get-Edge
Get-Java64
Get-Java32
Get-AdobeReader64
Get-AdobeReader32
Get-AdobeAcrobat64
Get-AdobeAcrobat32
Get-7zip
Get-Notepad++
Keepass
Get-Putty
Get-WinSCP
Get-WinZip
Get-Wireshark
Get-Zoom
Get-ZoomPlugin
Get-AmazonCorretto
Get-Webex
Get-GoToMeeting
Get-VMwareTools
Get-RingCentral
Get-Foxit
Write-Host "SCRIPT COMPLETE"
}
Else {
Write-Host "This device does not have an EPCache folder so it must not be a Probe, exiting script"
}