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

  • BenBen AWS Team

    Team Member

    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

  • thanks I will wait to hear back

  • ag_anaag_ana

    Team Member

    :+1:

  • BenBen AWS Team

    Team Member

    @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

  • Andy2002aAndy2002a
    edited May 30

    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_anaag_ana

    Team Member

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

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file