Skip to main content
March 14, 2023
Question

op item edit removes " Character from Password

  • March 14, 2023
  • 2 replies
  • 62 views

Hi,

i try to update an item password with 1Password Cli which has a " Character in it. This character is removed from password when the password is written to the vault. I've tried already some variations of passing the password to the CLI but unfortunately it does always remove all " characters from the password.

Any ideas or hints how to get i written correctly?

Regards
Stefan


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided

2 replies

March 15, 2023

Hi,
I've found a solution for the mentioned problem. What is strange is, that the behavior is different if you call op item edit in PowerShell 5, Powershell 7 or for example zsh on MacOS.

In Powershell 5 it is required to Mask the " character with a \. I've came op with the following code that will handle that situation. Maybe it is useful for someone!

$Password = 'T"e""s"t'

If ($PSVersionTable.PSVersion.Major -le '5') {
$Password = $Password.Replace('"','\"')
}

$Command = 'op item edit "{0}" ''password={1}''' -f $("TestItem", $Password)

Invoke-Expression -Command $Command

Kind regards
Stefan

Dayton_ag
1Password Employee
April 25, 2023

Hi @hayduk thanks so much for sharing this workaround for Powershell 5.1! 😄