Error when adding file to zip (PowerShell)

Dec 23, 2009 at 8:55 PM

I'm running the following (very simple) code in Powershell V2 CTP3:

[System.Reflection.Assembly]::LoadFrom("F:\Scripts\zip\bin\Ionic.Zip.dll");

$zip =  new-object Ionic.Zip.ZipFile

$zip.AddFile("F:\Scripts\zip\uncompressed.txt");
$zip.Save("MyZipFile.zip")
$zip.Dispose()

 

I'm getting the following error:

Exception calling "AddFile" with "1" argument(s): "Request for the permission of type 'System.Security.Permissions.File
IOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
At F:\Scripts\zip\1.ps1:5 char:13
+ $zip.AddFile <<<< ("F:\Scripts\zip\uncompressed.txt");
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

I'm running the newest version of DotNetZip. I'm not sure where the permissions issue lies. I've gone so far as to give "Everyone" full rights to try to get it to work.

Coordinator
Dec 24, 2009 at 1:19 PM

I don't know, but if I Were you I would run ProcMon from sysinternals and see which file is getting the exception, and why.

Is there a larger stack trace? A way to get a larger stack trace?