# Unzip with PowerShell all files in Folder (Directory)

In this post, you’ll learn how I Unzip all the Zip files in a folder with PowerShell.

I quite often need to use PowerShell scripts to work with a group of VMs that I produce so that people can deliver IT Camps across the world. When I get these VMs (they’re recreated periodically) I need to import them into my hosting environment. The VMs come in the form of ZIPs so here’s a script that will

```\$dir = \\your_sever\your_dir

\$scriptblock = {
function Expand-ZIPFile(\$file, \$destination)
}

\$shell = new-object -com shell.application
\$zip = \$shell.NameSpace(\$file)
foreach(\$item in \$zip.items())
{
\$shell.Namespace(\$destination).copyhere(\$item)
}
}

Expand-ZIPFile \$args[0].fullname -destination \$args[1] +"\"+ \$args[0].Name.Split("_")[0]}
dir \$dir | foreach {start-job -ArgumentList \$_,\$dir -ScriptBlock \$scriptblock}```

The interesting thing about this script is that it makes use of dir, which is an alias of Get-ChildItem.