Getting ERROR output in PowerShell
I can't seem to capture the ERROR output of OP when running it in power shell.
I'm running the command below, but nothing gets saved to the variable so I can't evaluate the result.
$result = Invoke-Expression "$OnePassAppPath create item login BADINPUT"
$result is always $null no matter what i do
1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided
Referrer: forum-search:OP output
Comments
-
Hey @Andy2002a
I'm sorry for the trouble with this, and for the delay in getting a reply to you. I've brought this to the attention of our development team, and they are investigating further. We'll be in touch with better information as soon as we have some. :)
Ben
0 -
thanks I will wait to hear back
0 -
:+1:
0 -
Is there a reason to use 'Invoke-Expression' for these commands? I'm speaking with development and they're indicating it's generally not advised to use it except in specific circumstances.
Could you please try something like
$result = op create item login BADINPUT 2>&1
Instead? $result should contain stderr.Please let me know if that works. Thanks.
Ben
0 -
I was using Invoke-Expression since it's required to get the sign in to work.
I just tested with the format you recommended and it appears to have worked. I will try using that going forward.
Thanks!
0 -
On behalf of Ben, you are welcome @Andy2002a! If you have any other questions, please feel free to reach out anytime.
Have a wonderful day :)
0