Invoke Power Shell error contains information that I need

I am trying the get the unlock data of the bootloader of my phone. I can use a simple command called “fastboot oem get_unlock_data” and it works in Power Shell.

I want to put the output of the command into a variable for later use.
The problem I am facing is that one of two things happen.

ContinueOnError is False and I get this error:

ContinueOnError is True and it does not put anything into the variable.

I think that the information I need is located in the error after “Unlock data:”.

Is there any way to get the long string of numbers, letters and characters from the error?

Any help is appriciated.

Use try catch inside PS script and set output argument to catch the error message.


Yep. This works. In the Try Catch you can use the Exception as a variable and you can access the “Exception Message” like Assign Message = “Exception.Message.ToString” or something like that.

1 Like

Thank you for your help!

1 Like

I got it to work. Thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.