Files

90 lines
3.6 KiB
PowerShell

<#
Author: Gabe Kerntke
Date: 06-18-2024
.Synopsis
Script to install Zoom on machines that do not already have it or upgrade to the newest version if behind
.Modified
2024-06-18 (GabeK) - Original script created
2025-08-08 (GabeK) - Updated to use functions script
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory = $false)]
$App_Name = "Zoom Workplace",
[Parameter(Mandatory = $false)]
$File_Name_Prefix = "zoom-x64",
[Parameter(Mandatory = $false)]
$File_Name_Extension = "msi",
[Parameter(Mandatory = $false)]
$Install_Parameters = "/quiet /qn /norestart",
[Parameter(Mandatory = $false)]
$EPCache_Folder = "3rd Party Patches\$App_Name",
[Parameter(Mandatory = $false)]
$Online_Version = (Invoke-RestMethod "https://zoom.us/rest/download?os=win").result.downloadVO.zoomX64.version,
[Parameter(Mandatory = $false)]
$DownloadURL = "https://zoom.us/client/latest/ZoomInstallerFull.msi?archType=x64",
[Parameter(Mandatory = $false)]
$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*") {
$InstallPathMSI = Test-Path "C:\Program Files\Zoom\bin\Zoom.exe"
If ($InstallPathMSI -eq $True) {
#Get currently installed version
$zoomPath = Get-ChildItem -Path "C:\Program Files\Zoom\bin\" -Filter "Zoom.exe" -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
$zoomVersion = (Get-ItemProperty -Path $zoomPath).VersionInfo.ProductVersion
$Local_Version = $zoomVersion.replace(',', '.')
#Comparing version already installed to what is online
If ([version]$Local_Version -lt [version]$Online_Version) {
Test-Probe_Online
Close-App
Install-App
}
Else { Write-Host "$App_Name already on latest version (Installed version: $Local_Version)" }
}
}
Else { Write-Host "$App_Name MSI not installed, checking under users." }
#Check to see if program is installed per user
$users = Get-ChildItem C:\Users
foreach ($user in $users) {
If (Test-Path "C:\Users\$($user.Name)\AppData\Roaming\Zoom\bin\Zoom.exe") {
#Get currently installed version
$zoomPath = Get-ChildItem -Path "C:\Users\$($user.Name)\AppData\Roaming\Zoom" -Filter "Zoom.exe" -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
$zoomVersion = (Get-ItemProperty -Path $zoomPath).VersionInfo.ProductVersion
$Local_Version = $zoomVersion.replace(',', '.')
#Comparing version already installed to what is online
If ([version]$Local_Version -lt [version]$Online_Version) {
Write-Host "$App_Name is installed for $user"
Test-Probe_Online
Close-App
Install-App
}
Else { Write-Host "$App_Name is already on the latest version ($LocalVersion) for $user" }
}
Else { Write-Host "Not installed for $user" }
}
If (Get-Software | Where-Object { $_.DisplayName -like "*$App_Name*" }) {}
Else {
Test-Probe_Online
Install-App
}
#Region Script End