Hi, Currently there are several VMs installed with third-party software (7zip) which is not been upgraded, I am seeking help to build an automation pipeline to upgrade them all at once.
I need Powershell or bash script.
Appreciate your company.
Hi, Currently there are several VMs installed with third-party software (7zip) which is not been upgraded, I am seeking help to build an automation pipeline to upgrade them all at once.
I need Powershell or bash script.
Appreciate your company.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amira BedhiafiRank #601 · 4K reputationPosted Jan 14, 2025, 8:06 AM EST
If you are familiar with PowerShell you can use a script that connects to each VM, checks the installed version of 7zip, and upgrades it if necessary.
This is an example I didn't test it but you can check it :
# Define the list of VM names or IPs $VMs = @('VM1', 'VM2', 'VM3') # Replace with actual VM names or IPs # Define the URL for the latest 7zip installer (ensure the URL points to a valid .exe or .msi file) $installerURL = 'https://www.7-zip.org/a/7z1900-x64.msi' # Example URL for 64-bit version of 7zip # Function to upgrade 7zip on a VM function Upgrade-7zip { param ( [string]$vmName ) try { # Check the installed version of 7zip $installedVersion = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -like "7-Zip*"} | Select-Object -First 1 # If 7zip is installed, compare the versions if ($installedVersion) { $currentVersion = $installedVersion.Version Write-Host "Current 7zip version on $vmName: $currentVersion" # Example check: you can compare with the latest version available (you can store this or check dynamically) $latestVersion = '19.00' # Example, update based on the latest available version if ($currentVersion -lt $latestVersion) { Write-Host "7zip on $vmName is outdated. Upgrading..." # Download the latest installer Invoke-WebRequest -Uri $installerURL -OutFile "C:\Temp\7zip_installer.msi" # Install the latest version of 7zip Start-Process -FilePath "msiexec.exe" -ArgumentList "/i C:\Temp\7zip_installer.msi /quiet /norestart" -Wait # Optionally, you can clean up the installer Remove-Item "C:\Temp\7zip_installer.msi" Write-Host "7zip upgraded on $vmName." } else { Write-Host "7zip on $vmName is already up to date." } } else { Write-Host "7zip is not installed on $vmName." } } catch { Write-Host "An error occurred while upgrading 7zip on $vmName: $_" } } # Loop through each VM and upgrade 7zip foreach ($vm in $VMs) { # Use Invoke-Command or PowerShell Remoting to run the script on each VM Invoke-Command -ComputerName $vm -ScriptBlock { param ($vmName) Upgrade-7zip -vmName $vmName } -ArgumentList $vm }If you're familiar with Ansible, you can automate the upgrade of 7zip across multiple VMs (Windows and Linux) using a simple playbook since it provides a consistent way to manage automation tasks across environments.
If you already use System Center Configuration Manager (SCCM) to manage your Windows environments, you can automate software upgrades like 7zip directly from SCCM.
Links to help you ;
Installing or updating 7-Zip using PowerShell - Perplexity
GitHub - msmak1990/auto-install-7Zip: PowerShell script to install silently 7-Zip binary (Windows 10 + PS ver5.1.x) by getting latest version from its site. All done by automated way.
Running PS Scripts Against Multiple Computers - Automation Admin
How to Automate KB5040434 Installation on Multiple VMs? | Microsoft Community Hub