Download and install the latest version of 5 base applications

An acquaintance saw my MECM lab environment the other day and saw how I was automatically downloading the latest versions of some applications (which were then automatically distributed and installed on the client computers), and thought it looked “cool”.
My acquaintance does not run MECM, or similar systems. But wanted me to show how he could automatically download and install latest version of some base applications.
So, I took my scripts and tweaked them for my acquaintance. Which then I thought I’d post them here (because it’s been ages since I posted anything).

Here you go, 5 applications that download and install automatically.


# 7-Zip
$7ZipDir = "C:\tmp\Latest\Apps\"
$dlurl = '' + (Invoke-WebRequest -Uri '' | Select-Object -ExpandProperty Links | Where-Object {($_.innerHTML -eq 'Download') -and ($_.href -like "a/*") -and ($_.href -like "*x64.msi")} | Select-Object -First 1 | Select-Object -ExpandProperty href)
# above code borrowed from:
$installerPath = Join-Path $7ZipDir (Split-Path $dlurl -Leaf)
Invoke-WebRequest $dlurl -OutFile $7ZipDir\7z-x64.msi
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$7ZipDir\7z-x64.msi`" /qn ALLUSERS=2 REBOOT=REALLYSUPPRESS" -Wait -PassThru

# Google Chrome

# Google Chrome
$ChromeDir = "C:\tmp\Latest\Apps\GoogleChromeStandaloneEnterprise64.msi"
Invoke-WebRequest -Uri "" -OutFile $ChromeDir
Start-Process msiexec.exe -Wait -ArgumentList '/I $ChromeDir /qn ALLUSERS=2 REBOOT=REALLYSUPPRESS'
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"C:\tmp\Latest\Apps\GoogleChromeStandaloneEnterprise64.msi`" /qn ALLUSERS=2 REBOOT=REALLYSUPPRESS" -Wait -PassThru

Microsoft PowerShell 7

# Microsoft PowerShell 7
$metadata = Invoke-RestMethod
$release = $metadata.ReleaseTag -replace '^v';"${release}/PowerShell-${release}-win-x64.msi"
#above code borrowed from:
$PowerShellDir = "C:\tmp\Latest\Apps\PowerShell-7-win-x64.msi"
Invoke-WebRequest -Uri "${release}/PowerShell-${release}-win-x64.msi" -OutFile $PowerShellDir
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"C:\tmp\Latest\Apps\PowerShell-7-win-x64.msi`" /qn ALLUSERS=2 REBOOT=REALLYSUPPRESS" -Wait -PassThru

Mozilla Firefox

# Mozilla Firefox
$FirefoxDir = "C:\tmp\Latest\Apps\FirefoxSetup.msi"
Invoke-WebRequest -Uri "" -OutFile $FirefoxDir
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"C:\tmp\Latest\Apps\FirefoxSetup.msi`" /qn" -Wait -PassThru


# Notepad++
$NotepadDir = 'C:\tmp\Latest\Apps\'
$href = ((Invoke-WebRequest -Uri '').Links | Where-Object { $_.innerText -match 'current version' }).href
$downloadUrl = ((Invoke-WebRequest "$href").Links | Where-Object { $_.innerHTML -match 'installer' -and $_.href -match 'x64.exe' }).href
Invoke-RestMethod $downloadUrl -OutFile "$NotepadDir\npp.installer.x64.exe"
Start-Process -FilePath "$NotepadDir\npp.installer.x64.exe" -ArgumentList "/S" -PassThru


Psst, are you using Microsoft 365? Don’t miss out my old blog post, Microsoft 365 Apps (Office 365) hantering i MECM (SCCM)


#7-Zip, #GoogleChrome, #MicrosoftPowerShell7, #MozillaFirefox, #Notepad++, #Microsoft365Apps