View Single Post
Old 11-28-2007   #5 (permalink)
Brandon Shell [MVP]


 
 

Re: native command messages/errors

As a note here.. I have a blog series on Error handling.

http://bsonposh.com/modules/wordpress/?p=51

$erroractionpreference/$error may not have effect on "native" commands.


Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

M> Joey wrote:
M>
Quote:
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!
>>
M> This should help:
M> http://blogs.msdn.com/powershell/arc...oraction-and-e
M> rrorvariable.aspx
M> PowerGadgets MVP
M> http://www.powergadgets.com/mvp
M> Blog:
M> http://marcoshaw.blogspot.com


My System SpecsSystem Spec