0 0

Extract Password Protected zip

Download, extract and silent install msi file from password protected zip.

set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
$ProgressPreference = "SilentlyContinue"
$Link = "https://www.link.to/file.zip"
$Pass = "Passw0rd"
$Path = "C:\Users\Public\Downloads"
$File = "file.zip"
$Msi = "contents.msi"
$7zo = "-aoa"

if (Test-Path $Path\$File) {
  Remove-Item $Path\$File
}
Invoke-WebRequest -Uri $Link -OutFile $Path\$File -UseBasicParsing
sz x $Path\$File "-p$Pass" "-o$Path" $7zo
msiexec.exe /i "$Path\$Msi" /qb