SubConnections or Children - please choose one of them an be consistent
If you using Get-RDMSession you get Objects from RemoteDesktopManager.PowerShellModule.PSOutputObject.PSConnection Class.
This Class implements the SubConnectons Property.
When you create a new Session with New-RDMSession you get an Object from Devolutions.RemoteDesktopManager.Business.Connection Class.
This Class implements the Children Property.
When you're working on powershell scripts which updates sessions if they exist and create theme if they don't exist it is much more difficult just to choose the right property depending on the object type.
Please also make Objects backward compatible. So creating an AliasPropery for the old name will help us to keep old scripts running.
Regards,
Thomas Kritzinger
Hi,
I'm trying to figure out what is the proper function that you tell me, but my I'm not sure to fully understand. Could you give us an example of what is the best function or what is the bug reported.
Best regards,
David Grandolfo
Scenario A: You want to create a new session with sub sessions.
To achieve this you use $session = New-RDMSession to create a new session variable.
Now you want to create sub session: $sub_session = New-RDMSession ...
And you want to assign the sub session to the session: $session.SubSessions += $sub_session;
But wait - there is no property called SubSessions. $session only have a property called Childs.
So you try $sessions.Childs += $sub_session, and it works.
Scenario B: You want to add a sub session to an existing session.
So, starting with $session = Get-RDMSession; Then create a new sub session: $sub_session = New-RDMSession ...
Now you want to assign the sub session to the existing session. In scenario A you learned, that the property is called Childs - right?
So you try $sessions.Childs += $sub_session. But this time there is no Property called Childs. Now the Property is called SubSessions.
So $sessions.SubSessions += $sub_sessions will work for you this case.
So if you want to add a sub session to a newly created session, you have to use the Childs Property. If you want to read or add sub sessions to an existing session you have to use the SubConnections Property.
The name of the classes is telling me that code for reading data with powershell was completely rewritten while the new-rdmsession part is kind of legacy.
Hi Thomas,
After talking to an PowerShell engineer we will adjust the function. Because as you said it's a bit confusing.
We will modify New-RDMSession to return both to the same entry type.
Best regards,
David Grandolfo
Thank you!
Please also note that currently a PSSession object has no password property. So reading a password or setting a password you have to use Get/Set-RDMSessionPassword.
I think other customers would want to use the New-RDMSession Cmdlet to batch import Passwords with their own script. So they would need something like a "NewPassword" Property to set a password or override a existing password.
Please also think about using the same date type for PSSession Object, Get-RDMSessionPassword and Set-RDMSessionPassword.
Currently Get-RDMSessionPassword returns Password in plain text while Set-RDMSessionPassword only accepts a secure string.
It would be nice using a secure string for all commands, including the PSSession Class for Set-RDMSession.
Get/Set-RDMSessionPassword should have a optional parameter like -AsPlaintext for using password as a plain text.
Regards,
Thomas Kritzinger
Hi,
New-RDMSession returns a PSConnection object, which means that you can put your new session in a variable and then use Set-RDMSessionPassword to set a password. The session will be in the database only after having called Set-RDMSession.
For example:$newSession = New-RDMSession -Name "MySession" -Type RDPConfigured$newSession.UserName = "username"Set-RDMSessionPassword -Session $newSession -Password (ConvertTo-SecureString -AsPlainText "password" -Force)Set-RDMSession -Session $newSession
For the Set/Get-RDMSessionPassword, I agree that Get-RDMSessionPassword could return the password as a string secure or as plain text. We will add an parameter as you mentioned.
Best regards,
Olivier Désalliers