Extracting Password Protected Archives with PowerShell


It appears there is no clean (easy) way in PowerShell to extract a compressed archive that is password protected. Booo!


After much searching it seems the easiest way involves downloading and installing the free and Open Source 7Zip.

This then makes the solution very easy…

$7-ZipPath = "C:\Program Files\7-Zip\7z.exe"
$zipFile = "passwordprotectedtest.zip"
$zipFilePassword = "Foo"

& $7-ZipPath e -oC:\ -y -tzip -p"$zipFilePassword" "$zipFile"


One thought on “Extracting Password Protected Archives with PowerShell

  1. This continues to give me an error: cannot find archive. If i provide the full path i also get an error: cannot use absolute pathnames.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s