Update App Install or Upgrade Scripts/App - Webex - Install or Upgrade.ps1

This commit is contained in:
2025-08-07 18:07:13 +00:00
parent d2fcb4b06a
commit 36a9c8093d
@@ -1,68 +1,68 @@
<# <#
Author: Gabe Kerntke Author: Gabe Kerntke
Date: 02-20-2024 Date: 02-20-2024
.Synopsis .Synopsis
Script installs Webex silently on machines that do not already have it. Script copies the installer from the probe and deletes the installer once the install is finsihed. Script installs Webex silently on machines that do not already have it. Script copies the installer from the probe and deletes the installer once the install is finsihed.
.Modified .Modified
2024-02-20 (GabeK) - Original script created 2024-02-20 (GabeK) - Original script created
2025-06-30 (GabeK) - Updated to use functions script 2025-06-30 (GabeK) - Updated to use functions script
#> #>
[CmdletBinding()] [CmdletBinding()]
Param( Param(
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
$App_Name = "Webex", $App_Name = "Webex",
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
$File_Name_Prefix = "Webex-x64", $File_Name_Prefix = "Webex-x64",
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
$File_Name_Extension = "msi", $File_Name_Extension = "msi",
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
$Install_Parameters = "ACCEPT_EULA=TRUE ALLUSERS=1 /qn", $Install_Parameters = "ACCEPT_EULA=TRUE ALLUSERS=1 /qn",
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
$EPCache_Folder = "3rd Party Patches\$App_Name", $EPCache_Folder = "3rd Party Patches\$App_Name",
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
$Version_URL = "https://help.webex.com/en-us/article/mqkve8/Webex-App-%7C-Release-notes" $Version_URL = "https://help.webex.com/en-us/article/mqkve8/Webex-App-%7C-Release-notes"
) )
#Download the HTML content #Download the HTML content
$html = (New-Object System.Net.WebClient).DownloadString($Version_URL) $html = (New-Object System.Net.WebClient).DownloadString($Version_URL)
# Split the content on ">" and "<" characters to extract the text content # Split the content on ">" and "<" characters to extract the text content
$html_split = $html.Split([char[]]@(">", "<"), [StringSplitOptions]::RemoveEmptyEntries) | Select-Object -First 900 $html_split = $html.Split([char[]]@(">", "<"), [StringSplitOptions]::RemoveEmptyEntries) | Select-Object -First 900
$Sort = $html_split -like "Windows*" $Sort = $html_split -like "Windows*"
# Filter out only the rows containing version numbers # Filter out only the rows containing version numbers
$Versions = $Sort | Where-Object { $_ -match "\d+\.\d+\.\d+" } | ForEach-Object { $_ -replace "&#xA0;", "" } $Versions = $Sort | Where-Object { $_ -match "\d+\.\d+\.\d+" } | ForEach-Object { $_ -replace "&#xA0;", "" }
$Online_Version = $Versions -replace "[^\d*\.?/\d*]" , '' -replace "/" , '' $Online_Version = $Versions -replace "[^\d*\.?/\d*]" , '' -replace "/" , ''
$DownloadURL = "https://binaries.webex.com/WebexTeamsDesktop-Windows-Gold/Webex_en.msi" $DownloadURL = "https://binaries.webex.com/WebexTeamsDesktop-Windows-Gold/Webex_en.msi"
$File_Name = "$File_Name_Prefix-$Online_Version.$File_Name_Extension" $File_Name = "$File_Name_Prefix-$Online_Version.$File_Name_Extension"
#Region Script Start #Region Script Start
If ((Test-Path "C:\Temp\Script Cache") -eq $False) { New-Item -ItemType directory -Path "C:\Temp\Script Cache" } 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" 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" . "C:\Temp\Script Cache\Functions.ps1"
#Check to see if program is installed #Check to see if program is installed
$Applist = Get-Software | Sort-Object -Descending $Applist = Get-Software | Sort-Object -Descending
If ($Applist.DisplayName -like "*$App_Name*") { If ($Applist.DisplayName -like "*$App_Name*") {
#Get currently installed version #Get currently installed version
$Local_Version = Get-Software | Where-Object { $_.DisplayName -like "*$App_Name*" } | Select-Object -ExpandProperty DisplayVersion $Local_Version = Get-Software | Where-Object { $_.DisplayName -like "*$App_Name*" } | Select-Object -ExpandProperty DisplayVersion
#Comparing version already installed to what is online #Comparing version already installed to what is online
If ($Local_Version -lt $Online_Version) { If ([version]$Local_Version -lt [version]$Online_Version) {
Test-Probe_Online Test-Probe_Online
Close-App Close-App
Install-App Install-App
} }
Else { Write-Host "$App_Name already on latest version (Installed version: $Local_Version)" } Else { Write-Host "$App_Name already on latest version (Installed version: $Local_Version)" }
} }
Else { Else {
Test-Probe_Online Test-Probe_Online
Install-App Install-App
} }
#Region Script End #Region Script End