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 $session.id -property AutoReconnection -Value False
Why use set-rdmsessionproperty over assigning them direct with $session.Attribute
Hi,
$session.AutoReconnection is expecting a boolean. By assigning $false, it should work.$session.AutoReconnection = $false
Best regards,
Olivier Désalliers
Hello,
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 https://poshoholic.com/2007/09/13/essential-powershell-beware-of-promiscuous-types/.
Best regards,
Érica Poirier
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.