Forum / Remote Desktop Manager - PowerShell Repository

Power Shell Set Property

  • Create an Issue
  • Cancel

Hi,

Im trying to set an SSH entry to use a key file in the repository:


$keyfile = Get-RDMSession | Where-Object {$_.Name -eq $SSHKeyFile}
Write-Output $keyfile.id

Set-RDMSessionProperty $Session.ID -Path "Terminal" -Property "PrivateKeyType" -Value "Link"
Set-RDMSessionProperty $Session.ID -Property "PrivateKeyConnectionID" -Value "$keyfile.ID"


The write-ouput returns the correct value.

when the entry has been created and goto properties i get an error "Unable to find the private key entry. This setting will be lost"

Clock2 yrs

Hello,

Normally, to have the UI refreshed after some operation made in a PowerShell script, you have to update the UI with the Update-RDMUI cmdlet. Could you please add it at the end of your script and see if you still have the issue?

Best regards,



Érica Poirier

signaturesignature

Clock2 yrs

Hi Erica,

Took a differnet approach to this but still cant get the entry correct:

i am now trying to edit the XML :


[xml]$xmlProperties = $Session.Terminal
$xmlProperties.Host = "$HostIP"
$xmlProperties.PrivateKeyPromptForPassPhrase = "False"
$xmlProperties.PrivateKeyType = "Link"
$Session.Terminal = $xmlProperties.InnerXml
[xml]$xmlProperties = $Session
$xmlProperties.PrivateKeyConnectionID = "10a46b93-52fb-471e-82d9-00baea99df03"
$Session = $xmlProperties.InnerXml


But it still doesnt work, can you help please.

Clock2 yrs

Hello,

The PrivateKeyType is an Enumeration type. So you cannot set it with the "Link" value.

Here are the values you can set in the PrivateKeyType property.

0 = NoKey
1 = File
2 = Data
3 = Link
4 = MyDefault
5 = PrivateVault

So, to set it to Link, you must set this property to the value 3.

Set-RDMSessionProperty  $Session.ID -Path "Terminal" -Property "PrivateKeyType" -Value 3

Best regards,



Érica Poirier

signaturesignature

Clock2 yrs