Unattended install of 7-Zip using PowerShell

Guillermo Musumeci
1 min readApr 4, 2020

I’m currently writing lots of building blocks of code to deploy Infrastructure as Code (IaC).

Here is a simple PowerShell script to download and deploy 7-Zip for Windows in unattended mode using PowerShell.

Download and Install 7-Zip v19 for Windows 32-bit

# Unattended Install of 7-Zip 32-bit v19

$Installer7Zip = $env:TEMP + "\7z1900.msi";
Invoke-WebRequest "https://www.7-zip.org/a/7z1900.msi" -OutFile $Installer7Zip;
msiexec /i $Installer7Zip /qb;
Remove-Item $Installer7Zip;

Download and Install 7-Zip v19 for Windows 64-bit

# Unattended Install of 7-Zip 64-bit v19

$Installer7Zip = $env:TEMP + "\7z1900-x64.msi";
Invoke-WebRequest "https://www.7-zip.org/a/7z1900-x64.msi" -OutFile
$Installer7Zip;
msiexec /i $Installer7Zip /qb;
Remove-Item $Installer7Zip;

Install 7-Zip PowerShell Module

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force;
Set-PSRepository -Name 'PSGallery' -SourceLocation "https://www.powershellgallery.com/api/v2" -InstallationPolicy Trusted;
Install-Module -Name 7Zip4PowerShell -Force;

And that’s all folks. If you liked this story, please show your support by 👏 this story. Thank you for reading!

--

--

Guillermo Musumeci
Guillermo Musumeci

Written by Guillermo Musumeci

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | ex-AWS | Entrepreneur | Book Author | Husband & Dad of ✌

No responses yet