diff --git a/App Install or Upgrade Scripts/App - VMware Tools - Install or Upgrade.ps1 b/App Install or Upgrade Scripts/App - VMware Tools - Install or Upgrade.ps1 new file mode 100644 index 0000000..eb674cd --- /dev/null +++ b/App Install or Upgrade Scripts/App - VMware Tools - Install or Upgrade.ps1 @@ -0,0 +1,72 @@ +<# +Author: Gabe Kerntke +Date: 05-10-2024 + +.Synopsis +#Script to update VMware Tools on machines (mostly used for zero days) + +.Modified +2024-05-10 (GabeK) - Original script created +2025-03-26 (GabeK) - Script updated with new logic to download to probe first +2025-08-05 (GabeK) - Script updated to use functions script +#> + +[CmdletBinding()] +Param( + [Parameter(Mandatory = $false)] + $App_Name = "VMware Tools", + [Parameter(Mandatory = $false)] + $File_Name_Prefix = "VMwareTools-x64", + [Parameter(Mandatory = $false)] + $File_Name_Extension = "exe", + [Parameter(Mandatory = $false)] + $Install_Parameters = '/S /v"/qn REBOOT=R"', + [Parameter(Mandatory = $false)] + $EPCache_Folder = "3rd Party Patches\$App_Name", + [Parameter(Mandatory = $false)] + $VersionURL = "https://packages.vmware.com/tools/releases/latest/windows/x64/", + [Parameter(Mandatory = $false)] + $Program = (Invoke-WebRequest -UseBasicParsing "$VersionURL").links.href -like "*exe*", + [Parameter(Mandatory = $false)] + $OnlineVersion = "$Program.split(" - ") | Select-Object -First 3 | Select-Object -Last 1", + [Parameter(Mandatory = $false)] + $File_Name = "$File_Name_Prefix-$Online_Version.$File_Name_Extension", + [Parameter(Mandatory = $false)] + $DownloadURL = "$VersionURL" + "$Program" +) + + +#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 + +$osInfo = Get-CimInstance -ClassName Win32_OperatingSystem +If ($osInfo.ProductType -ne "1") { + $Manufacturer = (Get-CimInstance Win32_ComputerSystem).Manufacturer + If ($Manufacturer -eq "VMware, Inc.") { + If ($Applist.DisplayName -like "*$AppName*") { + #Get currently installed version and trim version number + $string = $Applist.DisplayVersion + $start = 0 + $length = 6 + $LocalVersion = $string.Substring($start, [Math]::Min(($string.Length - $start), $length)) + + If ($LocalVersion -lt $OnlineVersion) { + Test-Probe_Online + Install-App + } + Else { Write-Host "$AppName already on latest version (Installed version: $LocalVersion)" } + } + Else { + Test-Probe_Online + Install-App + } + } + Else { Write-Host "Server is not VMware, exiting script" } +} +Else { Write-Host "Device is not a server, exiting script" } +#Region Script End \ No newline at end of file