Forum / Remote Desktop Manager - PowerShell Repository

Set-RDMSession.method not working but Set-RDMSessionProperty does

  • Create an Issue
  • Cancel

I was trying to change all of my RDP sessions in powershell

I tried

$Sessions = Get-RDMSession | where {$_.Kind -eq "RDPConfigured"}
foreach ($session in $Sessions)
{$session.AutoReconnection = 'False'

Set-RDMSession $session -refresh}

It completes without error however does not set the value to false.
If the value is already false, it changes it to true

I eventually discovered I could set it with this command instead

set-rdmsessionproperty -id $ -property AutoReconnection -Value False

Why use set-rdmsessionproperty over assigning them direct with $session.Attribute

Clock4 yrs


$session.AutoReconnection is expecting a boolean. By assigning $false, it should work.

$session.AutoReconnection = $false

Best regards,

Olivier Désalliers


Clock4 yrs


For your information, if you convert any non-empty string (i.e. 'False') to a boolean value in PowerShell, the resulting boolean value will be True.

You can consult this web page about it

Best regards,

Érica Poirier


Clock4 yrs

Great thank you to both of you. I did not know Boolean types had to be assigned with a $ prefix.

Could you move this to the powershell section as the only bug is obviously me.

Clock4 yrs