Unzip several files with PowerShell

Here is a function I used to unzip several files using PowerShell. 

function UnZipMe($zipfilename,$destination)
{
   $shellApplication = new-object -com shell.application
   $zipPackage = $shellApplication.NameSpace($zipfilename)
   $destinationFolder = $shellApplication.NameSpace($destination)

# CopyHere vOptions Flag # 4 – Do not display a progress dialog box.
# 16 – Respond with “Yes to All” for any dialog box that is displayed.

$destinationFolder.CopyHere($zipPackage.Items(),20)
}

$a = gci -Path C:inetpubiislogs3.comwwwlogs -Filter *.zip

foreach($file in $a)
{
    Write-Host “Processing – $file” UnZipMe –zipfilename
    $file.FullName -destination $file.DirectoryName
}

One thought on “Unzip several files with PowerShell”

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s