Monday, April 21, 2008

PowerShell error: Out-File: Unknown error "-1"

On the PowerShell newsgroup back in March, Peter Hultgren, indicated that was was getting an error from PowerShell that looked like this:

PS C:\> Get-Process Out-File -FilePath c:\test.txt
Out-File : Unknown error "-1".
At line:1 char:23
+ Get-Process Out-File <<<< -FilePath c:\test.txt

This would occur anytime he tried to write a file. Even trying to write to a different directory or usind add-content or set-content equally failed.

I raised the issue on a private MVP mailing list, and Lee Holmes, from Microsoft, quickly answered back that this was likely caused by an application named "Proventia Secure Desktop".

I provided the info back to Peter, and he confirmed that he had the application installed and that exiting it enabled PowerShell to work properly in this case.

Lee also added that this issue has come up a few times, and Microsoft submitted a bug through their bug process, but it doesn't seem to have been confirmed or tested by the vendor (http://www.iss.net/support). If you run accross this issue, please let the vendor know somehow either directly through their web site or via an account representative.