Installation

PowerShellZip is simply loaded as a module:
Import-Module {Your Path to the module} PowerShellZip.dll

Export-Zip

Exports the files in the pipeline (or the file given in the command line ) into one or multiple zip files.

SYNTAX
Export-Zip [[-ZipFile] <String>] [[-EntryFile] <String>] [[-EntryZip] <String>] [-EntryRoot <String>] [-EntryDir <String>] [-Append] [<CommonParameters>]
PARAMETER
-ZipFile <String>
Zip File Path
-EntryFile <String>
The path to the entry (file) to add in the zip archive. In pipelined mode files are detected by the properties Name and DirName
-EntryZip <String>
The path (directory + name) of the entry in the zip archive.
-EntryRoot <String>
The root directory for an entry. The zip archive will contain directories relative to the root
If the file C:\windows\system32\mmc.exe is added, a root setting of C:\ results in a zip entry \windows\system32\mmc.exe.
A root setting of C:\windows results in a zip entry \system32\mmc.exe and so on.
-EntryDir <String>
The base directory for enties in the zip archive. Every entry is perpended with this directory.
If the file C:\pagefile.sys is added, a directory setting of Backup\Dump results in a zip entry \Backup\Dump\pagefile.sys.
-Append
If zip archive exists, the files are added to the existing archive.

Last edited Mar 17, 2011 at 11:53 AM by ThomasMaierhofer, version 1

Comments

rdoron Oct 7, 2013 at 8:59 PM 
I had the same problem, until I changed the directory from where PS was executing. By default I think the shell was opened to: C:\Windows\System32. Once I changed into the directory where the files I wanted to zip up were, it worked. I had a PS prompt from within the PowerShell ISE. I just used the cd command to change directories. I also wrote a very small script and used the Set-Location cmdlet before calling Export-Zip, that also worked.

hamerg Feb 26, 2013 at 10:16 AM 
Creates 0KB files. Waste of time.

caiobauab Nov 5, 2012 at 4:04 PM 
Same, 0 zip file created for folder. What´s wrong?

AlreadyPicked Sep 26, 2012 at 3:56 PM 
Same here, empty zip file created. I wonder if it's because of the Paths...

nitinyewale May 3, 2012 at 3:27 AM 
Tried to create zip file with command mention in the documentation, but the zip file created is of 0 KB size... :(