Closed jesaldosa closed 4 years ago
Added in the error messaged from the script and calling it directly from the webapi
Hi @jesaldosa
I reproduced your scenario, and the message string you want can be obtained in the catch block like this:
$_.TargetObject.ErrorDetails.Message | ConvertFrom-Json | Select-Object -ExpandProperty Details
Thanks Pete. Ill give this a try tomorrow and let you know.
Cheers
Thanks Pete you are a super star
That worked! thank you
10.9
Hope you guys can help.
we have the following bit of code to add accounts from a CSV file using pspete powershell module
If the safe or platform does not exit it throws the following exception.
Error Message
If you run the same through the web api
Error Message via API
You get the full error message i.e platform not found. How can i get the correct error message from the Powershell script?
what changes are needed to the catch statement to make this work. Any help will be greatly appreciated.
Regards Jesal