View Single Post
Old 11-28-2007   #3 (permalink)
Marco Shaw [MVP]


 
 

Re: native command messages/errors

Joey wrote:
Quote:

> How do I get the verbose messages/errors displayed by native command calls
> back into a variable inside of powershell or at least to show up in the
> output? At the moment the closest thing I can find is the $lastexitcode
> variable which is good for determining if an error occurred but doesn't help
> in ascertaining the exact error message of a native command. The $error
> object contains nothing when a native command fails. I want to convert my
> processes over to powershell but without the ability to display exact error
> messages from native commands the benefits will not outweigh the hassles of
> trying to debug the scripts because the errors are not shown!

This should help:
http://blogs.msdn.com/powershell/arc...rvariable.aspx


--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec