Upload files to "App Install or Upgrade Scripts"
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
<#
|
||||||
|
Author: Gabe Kerntke
|
||||||
|
Date: 08-19-2024
|
||||||
|
|
||||||
|
.Synopsis
|
||||||
|
#Script to install Foxit Reader on machines that do not already have it
|
||||||
|
|
||||||
|
.Modified
|
||||||
|
2024-08-19 (GabeK) - Original script created
|
||||||
|
2025-05-02 (GabeK) - Rebuilt to use functions script
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
$App_Name = "Foxit PDF Reader",
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
$File_Name_Prefix = "FoxitReader-x64",
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
$File_Name_Extension = "exe",
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
$Install_Parameters = "/noshortcut /quiet /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /force",
|
||||||
|
[Parameter(Mandatory = $false)]
|
||||||
|
$EPCache_Folder = "3rd Party Patches\$App_Name"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Download the HTML content
|
||||||
|
$html = (New-Object System.Net.WebClient).DownloadString("https://www.foxit.com/pdf-reader/version-history.html")
|
||||||
|
|
||||||
|
# Split the content on ">" and "<" characters to extract the text content
|
||||||
|
$text = $html.Split([char[]]@(">", "<"), [StringSplitOptions]::RemoveEmptyEntries)
|
||||||
|
|
||||||
|
$Versions = $text | Where-Object { $_ -like "Version*" }
|
||||||
|
|
||||||
|
$Online_Version = $Versions -replace "[^\d*\.?/\d*]" | Select-Object -First 2 | Select-Object -Last 1
|
||||||
|
$DownloadURL = "https://www.foxit.com/downloads/latest.html?product=Foxit-Reader&platform=Windows&version=&package_type=&language=English&distID="
|
||||||
|
$File_Name = "$File_Name_Prefix-$Online_Version.$File_Name_Extension"
|
||||||
|
|
||||||
|
#Region Script Start
|
||||||
|
If ((Test-Path "C:\Temp\Script Cache") -eq $False) { New-Item -ItemType directory -Path "C:\Temp\Script Cache" }
|
||||||
|
Invoke-WebRequest -UseBasicParsing "https://scripts.gabesville.com/Gabesville/Powershell-Scripts/raw/branch/main/Functions%20Scripts/Functions.ps1" -outfile "C:\Temp\Script Cache\Functions.ps1"
|
||||||
|
. "C:\Temp\Script Cache\Functions.ps1"
|
||||||
|
|
||||||
|
#Check to see if program is installed
|
||||||
|
$Applist = Get-Software | Sort-Object -Descending
|
||||||
|
|
||||||
|
If ($Applist.DisplayName -like "*$App_Name*") {
|
||||||
|
|
||||||
|
#Get currently installed version
|
||||||
|
$Local_Version = Get-Software | Where-Object { $_.DisplayName -like "*$App_Name*" } | Select-Object -ExpandProperty DisplayVersion
|
||||||
|
|
||||||
|
#Comparing version already installed to what is online
|
||||||
|
If ($Local_Version -lt $Online_Version) {
|
||||||
|
Test-Probe_Online
|
||||||
|
Install-App
|
||||||
|
}
|
||||||
|
Else { Write-Host "$App_Name already on latest version (Installed version: $Local_Version)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
Else {
|
||||||
|
Test-Probe_Online
|
||||||
|
Install-App
|
||||||
|
}
|
||||||
|
#Region Script End
|
||||||
Reference in New Issue
Block a user