How can I get powershell exception descriptions into a string? -
I have access to a single message, when you send an error record in the output stream, PowerShell prints < / P>
Example:
This exception message is C: \ Documents and Settings \ BillBillington \ Desktop \ psTest \ exThrower.ps1: 1 character: 6 + throw < & Lt; & Lt; & Lt; (New-object Logic Expression ("This is an exception")); + Category Info: Operation: Sprint: (:) [], Logic Option + Fully Qualified Irread ID: This is the exception
When I can get an error by $ error [0] I do not think so Understand how to get this information in a simple way.
I got this 'solution error' function in the expanses of the community, which is what I want broadly but it is a huge semi-formatted The list prints I It does not need that I have to get a strip.
Does the message use powershield or there is no way of failing, which is an easy way to get the hash of values, Can I put a format of my choice in the string?
If you want a little message (more useful user sometimes?) @ Tomaszer suggests That would be:
$ error [0] .ostring () + $ error [0]. Designation message
you will find something like this:
path can not be found 'C: \ TEMP \ _100804_135716 \ missing because it does not exist In C: \ TEMP \ _100804_135716 \ test.ps1: 5 chars: 15+ receive-child items & lt; & Lt; & Lt; & Lt; Missing
This technical information will be excluded:
+ Category information: Object knotfound: (C: \ TEMP \ _100804_135716 \ Missing: string) [ Get-ChildItem], Item Notoff Exception + Fully Qualified Aroroid: Pathenautfound, Microsoft. PowerShell Commands.Get ChildItem Command
Comments
Post a Comment