1
0

zip-module.psm1 645 B

12345678910111213141516171819202122
  1. Function Expand-ZipFile($zipfile, $destination) {
  2. # This function unzips a zip file
  3. # Code obtained from:
  4. # http://www.howtogeek.com/tips/how-to-extract-zip-files-using-powershell/
  5. # Create a new directory if it doesn't exist
  6. If (!(Test-Path -Path $destination)) {
  7. $p = New-Item -ItemType directory -Path $destination
  8. }
  9. # Define Objects
  10. $objShell = New-Object -Com Shell.Application
  11. # Open the zip file
  12. $objZip = $objShell.NameSpace($zipfile)
  13. # Unzip each item in the zip file
  14. ForEach($item in $objZip.Items()) {
  15. $objShell.Namespace($destination).CopyHere($item, 0x14)
  16. }
  17. }