Closed sethwalker1 closed 5 months ago
keyPair
is a complex field. You can see field format by running Get-KeeperRecordType -ShowFields
privateKey privateKey Optional {'publicKey': '', 'privateKey': ''}
Fields like keyPair
expect hash tables as field value
$publicKey = @{'publicKey'='PUBLICKEY'; 'privateKey'='PRIVATE KEY'}
Add-KeeperRecord -RecordType sshKeys -Title $title -login $email -host $hostname -notes $notes -keyPair $publicKey
Multiline fields are set similarly
$ml = "Line1 `nLine 2"
Add-KeeperRecord ... '-multiline.Field Label' $ml
multiline
defines a field type that is shown as multiline text edit by Keeper clients.
-
dash in front of field means the field value is passed in the next argument
if there is no dash then the argument has format <FIELD_NAME>=<FIELD_VALUE>
. Only simple text can be supplied using this format.
Thanks for the quick and detailed response!
I initially had issues with your suggested approach, but I've now identified the issue being an extra line at the end of the key contents. After trimming the string, all is working correctly! I definitely believe this behavior is worthy of documentation somewhere, but I'm still curious if it's intended or unexpected.
I'm trying to create an SSH Key record that holds a GPG key using PowerCommander.
This code populates the
Private Key
field with the first line of the GPG key, but no more because multi-line inputs are not supported. I've tried saving without spacing, but the key is considered invalid if I do so.Possible solutions:
keyPair
argument to theAdd-KeeperRecord
cmdlet