write-zip throwing an exception

Topics: User Forum
Apr 27, 2015 at 11:21 PM
This is part of a script that ran nightly for over 10 months. It zips up pairs of log files and moves them to a folder synced to another machine with Box, which allows us to remove them from the machine.

In March, if threw an exception on a pair of files that was corrected by manually zipping and moving the files.

This weekend, the errors began again.

Here is a snippet of my script:
Add-Content $ScriptLogFileFull "Zipping $LogFileNameWildFull into $ZipNameFull"
Write-Zip $LogFileNameWildFull -OutputPath $ZipNameFull -Flatten -Quiet -ErrorAction: SilentlyContinue -ErrorVariable ErrorString 2>&1 | Out-Null
if(-not ($?))
   Add-Content $ScriptLogFileFull "ERROR zipping $LogFileNameWildFull into $ZipNameFull"
   Add-Content $ScriptLogFileFull $ErrorString
Here is the matching snippet in my log file:
Zipping C:\xyzdata\Recordings\DL14_4N_90W\20150423_201414.* into C:\xyzdata\Recordings\20150423_201414_DL14_4N_90W.zip
ERROR zipping C:\xyzdata\Recordings\DL14_4N_90W\20150423_201414.* into C:\xyzdata\Recordings\20150423_201414_DL14_4N_90W.zip
System.Management.Automation.CmdletInvocationException: Incorrect function.
 ---> System.IO.IOException: Incorrect function.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.ReadCore(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.FileStream.Read(Byte[] array, Int32 offset, Int32 count)
   at Pscx.Commands.IO.Compression.ArchiveWriter.WriterBase`2.Copy(Stream source, Stream destination, Byte[] buffer)
   at Pscx.Commands.IO.Compression.ArchiveWriter.SingleArchiveWriter`2.<>c__DisplayClass2.<ProcessFile>b__0(Stream inputStream)
   at Pscx.Commands.PscxCmdlet.Pscx.Commands.IPscxFileHandler.ProcessRead(String filePath, Action`1 action)
   at Pscx.Commands.IO.Compression.ArchiveWriter.SingleArchiveWriter`2.ProcessFile(FileInfo file)
   at Pscx.Commands.PscxPathCommandBase.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Other pairs of files in the directory zip without problem.

I'm using Powershell v3.0 and PSCX 3.1.0 on a Windows 7 machine. I have > 100 Gb of disc space free.

I would upgrade Powershell and PSCX, but this is running on a customer site and would require travel to fix.

Any ideas?