Getting ERROR output in PowerShell

Andy2002a
Andy2002a
Community Member

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

  • Andy2002a
    Andy2002a
    Community Member

    thanks I will wait to hear back

  • ag_ana
    ag_ana
    1Password Alumni

    :+1:

  • @Andy2002a

    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

  • Andy2002a
    Andy2002a
    Community Member
    edited May 2020

    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!

  • ag_ana
    ag_ana
    1Password Alumni

    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 :)

This discussion has been closed.