Dumping ZIP Archive Content

by Aug 27, 2018

PowerShell comes with new cmdlets like Extract-Archive that can extract (all) files from a ZIP file container. However, there is no way to just list the content of a ZIP file.

To do this, you can use the .NET libraries used by Extract-Archive. This code will take a ZIP file and dump its content (make sure you change the path to the ZIP file to a file that exists):

# adjust this to a valid path to a ZIP file
$Path = "$Home\Desktop\Test.zip"

# load the ZIP types
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead($Path)
$zip.Entries

$zip.Dispose()

Twitter This Tip! ReTweet this Tip!