From af61b17e0be5105bd74f3286b42b4b2e48ae5521 Mon Sep 17 00:00:00 2001 From: Gabe Date: Tue, 5 Aug 2025 17:06:00 +0000 Subject: [PATCH] Update App Install or Upgrade Scripts/App - Chrome - Install or Upgrade.ps1 --- .../App - Chrome - Install or Upgrade.ps1 | 122 +++++++++--------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/App Install or Upgrade Scripts/App - Chrome - Install or Upgrade.ps1 b/App Install or Upgrade Scripts/App - Chrome - Install or Upgrade.ps1 index a319fd5..94015a2 100644 --- a/App Install or Upgrade Scripts/App - Chrome - Install or Upgrade.ps1 +++ b/App Install or Upgrade Scripts/App - Chrome - Install or Upgrade.ps1 @@ -1,61 +1,61 @@ -<# -Author: Gabe Kerntke -Date: 05-10-2024 - -.Synopsis -Script to install Chrome on machines that do not already have it or upgrade to the newest version if behind - -.Modified -2024-05-10 (GabeK) - Original script created -2025-05-21 (GabeK) - Rebuilt to use functions script -#> - -[CmdletBinding()] -Param( - [Parameter(Mandatory = $false)] - $App_Name = "Chrome", - [Parameter(Mandatory = $false)] - $File_Name_Prefix = "Chrome-x64", - [Parameter(Mandatory = $false)] - $File_Name_Extension = "exe", - [Parameter(Mandatory = $false)] - $Install_Parameters = "/silent /install", - [Parameter(Mandatory = $false)] - $EPCache_Folder = "3rd Party Patches\$App_Name", - [Parameter(Mandatory = $false)] - $Version_URL = "https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions", - [Parameter(Mandatory = $false)] - $Online_Version = "Invoke-RestMethod $Version_URL | Select-Object -ExpandProperty versions | Select-Object -ExpandProperty version | Select-Object -First 1", - [Parameter(Mandatory = $false)] - $DownloadURL = "https://dl.google.com/chrome/install/latest/chrome_installer.exe", - [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*") { - - #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 - Close-App - Install-App - } - Else { Write-Host "$App_Name already on latest version (Installed version: $Local_Version)" } -} - -Else { - Test-Probe_Online - Install-App -} -#REgion Script End \ No newline at end of file +<# +Author: Gabe Kerntke +Date: 05-10-2024 + +.Synopsis +Script to install Chrome on machines that do not already have it or upgrade to the newest version if behind + +.Modified +2024-05-10 (GabeK) - Original script created +2025-05-21 (GabeK) - Rebuilt to use functions script +#> + +[CmdletBinding()] +Param( + [Parameter(Mandatory = $false)] + $App_Name = "Chrome", + [Parameter(Mandatory = $false)] + $File_Name_Prefix = "Chrome-x64", + [Parameter(Mandatory = $false)] + $File_Name_Extension = "exe", + [Parameter(Mandatory = $false)] + $Install_Parameters = "/silent /install", + [Parameter(Mandatory = $false)] + $EPCache_Folder = "3rd Party Patches\$App_Name", + [Parameter(Mandatory = $false)] + $Version_URL = "https://versionhistory.googleapis.com/v1/chrome/platforms/win64/channels/stable/versions", + [Parameter(Mandatory = $false)] + $Online_Version = "Invoke-RestMethod $Version_URL | Select-Object -ExpandProperty versions | Select-Object -ExpandProperty version | Select-Object -First 1", + [Parameter(Mandatory = $false)] + $DownloadURL = "https://dl.google.com/chrome/install/latest/chrome_installer.exe", + [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*") { + + #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 + Close-App + Install-App + } + Else { Write-Host "$App_Name already on latest version (Installed version: $Local_Version)" } +} + +Else { + Test-Probe_Online + Install-App +} +#Region Script End \ No newline at end of file