Is it possible set properties of subconnections or at least read them, after the main connection has been created? For example we have a server connection in RDM, I would like to add a subconnection to it for each internal component that we need to track a serial number on.
Clock6 yrs
|
|
Something like this should work. (not tested) # get the session $connection = Get-RDM-Session[0];# get children $children = $connection.Session.GetProperty("", "Children"); # child - 1 - set OS $children[0].SetProperty("MetaInformation", "OS", "Windows Server 2008 R2"); # child - 2 - set OS $children[1].SetProperty("MetaInformation", "OS", "Windows Server 2012");
Stefane Lavergne  
Clock6 yrs
|
|
After performing the get children step, all that seems to be being returned is a string. Devolutions.RemoteDesktopManager.Business.Connection[] Nick Moore
Clock6 yrs
|
|
Nick, you are correct we have a bug/feature (for security reasons) that won't let you use the GetProperty to get a none value type... I will have a new build for you within the next few hours that resolves the issue. Regards,
Stefane Lavergne  
Clock6 yrs
|
|
Nick, The issue has been resolved and is available here: http://download.devolutions.net/Devolutions.RemoteDesktopManager.Bin.9.1.0.0.zip Simply extract the files to your install directory. Stefane
Stefane Lavergne  
Clock6 yrs
|
|
Stefane, Sorry to say, it looks like the same thing is occurring with the new build. The GetProperty method is still returning a string instead of a new object. I've pasted in some of what I've been working with. I was able to use the GetProperty method to retrieve the MAC address from the connection, but I'm still only getting a string returned when using Children. $Connection=Get-RDM-Session | ?{$_.name -like "*2e47e*"} $Connection | Get-Member
TypeName: <>f__AnonymousType1`4[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Devolutions.RemoteDesktopManager.Business.PS.Session, RemoteDesktopManager.PowerShell, Version=9.1.0.0, Culture=neutral, PublicKeyToken=null]]
Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object value) GetHashCode Method int GetHashCode() GetType Method type GetType() ToString Method string ToString() Group Property string Group {get;} ID Property guid ID {get;} Name Property string Name {get;} Session Property Devolutions.RemoteDesktopManager.Business.PS.Session Session {get;} $Connection.Session | Get-Member
TypeName: Devolutions.RemoteDesktopManager.Business.PS.Session
Name MemberType Definition ---- ---------- ---------- Equals Method bool Equals(System.Object obj) GetHashCode Method int GetHashCode() GetProperty Method System.Object GetProperty(string path, string propertyName) GetType Method type GetType() SetCredentials Method bool SetCredentials(string userName, securestring password, string domain) SetPassword Method bool SetPassword(securestring password) SetProperty Method bool SetProperty(string path, string propertyName, System.Object value) ToString Method string ToString() AddOnData Property RemoteDesktopManager.AddOn.ISessionAddOnData AddOnData {get;} ConnectionSubType Property string ConnectionSubType {get;set;} ConnectionTypeName Property string ConnectionTypeName {get;} CreatedBy Property string CreatedBy {get;} CreationDateTime Property System.Nullable[datetime] CreationDateTime {get;} CredentialConnectionID Property string CredentialConnectionID {get;set;} CustomStatus Property string CustomStatus {get;set;} Description Property string Description {get;set;} DescriptionRtf Property string DescriptionRtf {get;set;} DescriptionUrl Property string DescriptionUrl {get;set;} Encrypt Property bool Encrypt {get;set;} Group Property string Group {get;set;} Host Property string Host {get;} ID Property guid ID {get;set;} IncludeInFavorite Property bool IncludeInFavorite {get;set;} Kind Property RemoteDesktopManager.AddOn.ConnectionKind Kind {get;set;} Name Property string Name {get;set;} OpenEmbedded Property bool OpenEmbedded {get;set;} ShowInTrayIcon Property bool ShowInTrayIcon {get;set;} SortPriority Property int SortPriority {get;set;} Status Property string Status {get;set;} Tag Property System.Object Tag {get;set;} UpdateDateTime Property System.Nullable[datetime] UpdateDateTime {get;} UpdatedBy Property string UpdatedBy {get;} $Connection.Session.GetProperty("MetaInformation","MAC") C464.13C2.E47E
$Connection.Session.GetProperty("","Children") Devolutions.RemoteDesktopManager.Business.Connection[] $Children=$Connection.Session.GetProperty("","Children") $children | get-member TypeName: System.String
Thank you for your help so far on this.
Clock6 yrs
|
|
My bad, I gave you the wrong download link. http://download.devolutions.net/Devolutions.RemoteDesktopManager.Bin.9.1.1.0.zip It will return you an array of type Sessions (Session[]) Regards,
Stefane Lavergne  
Clock6 yrs
|
|
That works great, I'm now able to get any information so far from the sub-connections. How would I go about setting updated information? So far, I've tried the following: $Connection=Get-RDM-Session | ?{$_.name -like "*2e47e*"} $Children=$Connection.session.getproperty("","Children") $Children[0].GetProperty("MetaInformation","SerialNumber") Test-sn Try 1, it takes the command like it accepted it but it doesn't actually update. Set-RDM-Property -ID $Children[0].ID -Path "MetaInformation" -Property "SerialNumber" -Value "Test=SN2" Try 2, removes the subconnection, makes it a normal connection and sets the field. Almost there. $Child0=$Children[0] Set-RDM-Session -Session $Child0 Try 3 $Connection.Session.Children=$Child0 The property 'Children' cannot be found on this object. Verify that the property exists and can be set. At line:1 char:1 + $Connection.Session.Children=$Child0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: ( [], RuntimeException + FullyQualifiedErrorId : PropertyAssignmentException Try 4 $Connection.Session.SetProperty("","Children",$Child0) Exception calling "SetProperty" with "3" argument(s): "Object of type 'Devolutions.RemoteDesktopManager.Business.PS.Session' cannot be converted to type 'Devolutions.RemoteDesktopManager.Business.Connection[]'." At line:1 char:1 + $Connection.Session.SetProperty("","Children",$Child0) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ( [], MethodInvocationException + FullyQualifiedErrorId : ArgumentException Any ideas?
Clock6 yrs
|
|
nmooremvsc wrote:
Try 1, it takes the command like it accepted it but it doesn't actually update. Set-RDM-Property -ID $Children[0].ID -Path "MetaInformation" -Property "SerialNumber" -Value "Test=SN2"
$Child0.SetProperty("MetaInformation", "SerialNumber", "Test=SN2"); Set-RDM-Session $parent.Session Why? Set-RDM-Property will only work a first level sessions, but since you have a child (of type Session) you can use the .SetProperty directly to update the value. Since this is a child session you must call Set-RDM-Session on the parent to persist the change:Set-RDM-Session $parent.Session
nmooremvsc wrote:
Try 2, removes the subconnection, makes it a normal connection and sets the field. Almost there. $Child0=$Children[0] Set-RDM-Session -Session $Child0 This is tricky, we need to create an array list so that we can remove the child session from it, create a new session, then reset the children of the initial parent to no longer have that child.#create array list $array = New-Object System.Collections.ArrayList($null) # remove child from list $array.AddRange($children) $array.Remove($Child0) # Save the child as a new session Set-RDM-Session -Session $Child0 # set the children of the parent to the remaining sessions in the array $Parent.SetProperty("", "Children", $array.ToArray()); # save the parent Set-RDM-Session $parent.Session
nmooremvsc wrote:
Try 3 $Connection.Session.Children=$Child0 The property 'Children' cannot be found on this object. Verify that the property exists and can be set. Set the children of a parent connection$Connection.SetProperty("", "Children", @($Child0));
@($Child0) creates an array of one element that contains $Child0, very important since Children expects an array.Ok hang on a second... the SetProperty("", "Children",...) might not work, since $Child0 is of type Session... I will need to do another fix... doh!
Stefane Lavergne  
Clock6 yrs
|
|
Ok forget every thing I wrote in the last post. I've added a new property to the Session type, wait for it... it's Children, this will simplify things 5 fold Here is how you use it: Get $children = $Connection.Session.Children
Set ArrayList with objects of Session or Connection type$Connection.Session.Children = $children or Session[]$Connection.Session.Children = $session1, $session2, $session3 or Connection[]$Connection.Session.Children = $connection1, $connection2, $connection3 or object[] where the elements are either of type Session or Connection$Connection.Session.Children = $connection1, $session2, $connection3
The build will be available soon. I will post the link, once it's available.Until then your code might look something like this. $list = Get-RDM-Session; $parent = $list[0]; $children = $parent.Session.Children # remove first child and save as a standalone session $firstChild = $children[0] $children.Remove($firstChild) Set-RDM-Session $firstChild# save parent with the child $parent.Session.Children = $children Set-RDM-Session $parent.Session
Simpler?Regards,
Stefane Lavergne  
Clock6 yrs
|
|
The build is available (same build number & file name) http://download.devolutions.net/Devolutions.RemoteDesktopManager.Bin.9.1.1.0.zip Regards,
Stefane Lavergne  
Clock6 yrs
|
|
Works great!! Thank you for all the help on this.
Clock6 yrs
|
|