I set my Metadata and other things per powershell. Version 8.3.2.0
After modifying 4 Servers (each 23 Fields) i get this error.Set-RDM-Property : Out of memory.At D:\SW\PortableApps\RemoteDesktopManager\POI-RDM-Data.ps1:230 char:7+ Set-RDM-Property -NoRefresh -ID $($Session.id) -Path 'MetaInformation' -Pr ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Set-RDM-Property], OutOfMemoryException + FullyQualifiedErrorId : System.OutOfMemoryException,Devolutions.RemoteDesktopManager.Business.PS.Commands.SetRDMPropertyCommand
The calling code is# i create an object$ServerMetainfo = "" | Select-Object Keywords,OS,State,Domain,Hardware,Softwares,CustomerNumber,Address,ZipCode,IsVirtualMachine,VirtualMachineName,ServerRemoteManagementUrl,ServerHomePageUrl,CustomField1Title,CustomField2Title,CustomField3Title,CustomField4Title,CustomField5Title,CustomField1Value,CustomField2Value,CustomField3Value,CustomField4Value,CustomField5Value# then i fill this object (code not displayed)# Finally i fill the this into the Set-RDM-Property (this is line 230) $MetaFields = $ServerMetainfo | Get-Member -MemberType NoteProperty | select Name,Definition foreach ($MetaField in $Metafields) { if (-not $ServerMetainfo.($MetaField.name)) {$ServerMetainfo.($MetaField.name) = ""} Set-RDM-Property -NoRefresh -ID $($Session.id) -Path 'MetaInformation' -Property "$($MetaField.name)" -value "$($ServerMetainfo.($MetaField.name))" } edited by Peter Cermak (POI) on 6/19/2013
Could you post the entire script (or send via private message). It looks like there might be a memory leak somewhere in the code. I've looked over the Set-RDM-Property and have not found any leak (as of yet).
Stéfane Lavergne
Try using the direct method instead of the Set-RDM-Property. The direct method should be faster and take less memory.
Instead of:Set-RDM-Property -NoRefresh -ID $($Session.id) -Path 'MetaInformation' -Property "$($MetaField.name)" -value "$($ServerMetainfo.($MetaField.name))"Try this:$Session.Session.SetProperty("MetaInformation", "$($MetaField.name)", "$($ServerMetainfo.($MetaField.name))")
Stéfane Lavergne
Hi,
With RDM 10.0 I tried it again.
The problem still exists :-( After about 50 calls of Set-RDM-Property i get the "out of memory".
As a Workaround could you please help me with this:
How do i use The Get-Property Method? $Session.Session.GetProperty()PS D:\> $Session.Session.GetProperty("PinEmbeddedMode")Cannot find an overload for "GetProperty" and the argument count: "1".At line:1 char:1+ $Session.Session.GetProperty("PinEmbeddedMode")+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodCountCouldNotFindBestThis shows me i need a second parameter for the method. What's this second parameter?
How do i set NON-MetaInformation? Like "PinEmbeddedMode", "PingConnectionMethod" or Colors.
BTW: After the update i now have 62 RDM cmdlets.
In my opinion you could still tweak the powershell cmdlets VERY much. I'd love to send you my comments ;)
Off topic: the Code tag should not resolve Smileys..
And also:
Modules - A package that contains Windows PowerShell commands int he form of functions, cmdlerts and workflows, in addition it may contain variables, aliases and providers. Modules can be written in PowerShell and/or compiled as DLLs.
Snap-Ins - Are compiled cmdlets in to a DLL written in a .Net language are being deprecated and no longer recommended as the way to create and package new cmdlets.
http://www.darkoperator.com/blog/2013/2/19/powershell-basics-extending-the-shell-with-modules-and-snapi.html
out of memory - I will need to have another look
GetProperty(string path, string propertyName) - it might have the same memory issue
PinEmbeddedMode is of type DefaultBoolean (tri-state: Default, True, False). DefaultBoolean.Default, DefaultBoolean.True or DefaultBoolean.False
PingConnectionMethod is an enum (Default, Ping, PortScan). Again try passing: PingConnectionMethod.PortScan...
Yes in v10 we added many new CmdLets & "deprecated" all old CmdLets (but they still work). Set-RDM-Property = old/deprecated use instead Set-RDMProperty simply remove the extra dash. The behavior won't always be 100%, so make sure you test the new CmdLet or stay with the old.
The new CmdLet are mostly management type: get/set user, get/set roles, get/set data source... The online documentation has yet to be update. If you run get-help get-RDMUser you should get something for some/most new CmdLets.
PowerShell comments? Yes please pass them along. v10 CmdLets should be better than the previous version but yes please pass along any comments. It's always appreciated.
P.S. Just now read your post about Modules vs Snap-Ins, not sure how would could change it at this point. We will need to look at this. Thank you for the information.
Smileys - I will look at the Forum code...
Stéfane Lavergne
Thank you for the very fast response :)
The Information about the new cmdlets is the greatest help ! And Set-RDM-Property is evil ;)
What i did before was: Create an Object-array with all my Metadata adn the in a foreach loop through this array and set the values.
Now ich can just read and set the $Session and $Session.MetaInformation directly and save it, which is much faster.
The new cmdlets update 636 Sessions in under 2 Minutes :), before that i ran for hours.
I really like that the complete objects are returned, so this "looking in exported session and using these data types manually" is no longer needed.
I still miss that the cmdlets don't support the -name parameter.
I hope i can provision users with the *-RDMUser cmdlets, maybe you hav an tip for importing AD-Users...?
Unfortunately the help is very empty for most cmdlets. PS D:\> Export-RDMSession -?NAME Export-RDMSessionSYNTAX Export-RDMSession [-Path] <string> [-Sessions] <Session[]> [-ExportType] <string> [-Password] <securestring> [[-IncludeCredentials]] [<CommonParameters>]ALIASES NoneREMARKS None
edited by Peter Cermak (POI) on 9/25/2014
Peter,
I've update the help file (-?) for the new CmdLet. Not sure how much is actually there. The file went from 80kb to 322kb so there must be something there :-) We will need to have a look at all commands and make sure the documentation is complete and generate the online help accordingly. Sorry for the delay, the dev that was working on PS module has finished is summer work term and is now back at school.
I've attched the help file, you can try to replace the file within your application directory (no need to wait for the next build). You might have to start a new PS session for the help file to be loaded.
Can you elaborate on this? I don't understand.
You can (see list below) but I have no clue how you would go about listing/reading AD-Users in PS.
Here is a list of all the CmdLets
New CmdLetAdd-RDMUserRoleClose-RDMSessionExport-RDMSessionGet-RDMCurrentDataSourceGet-RDMDataSourceGet-RDMDataSourcePropertyGet-RDMRoleGet-RDMSecurityGroupGet-RDMSessionGet-RDMSessionDomainGet-RDMSessionPasswordGet-RDMSessionPropertyGet-RDMSessionUserNameGet-RDMTemplateGet-RDMUserNew-RDMDataSourceNew-RDMRoleNew-RDMSessionNew-RDMUserOpen-RDMSessionRemove-RDMCurrentDataSourceRemove-RDMRoleRemove-RDMSecurityGroupRemove-RDMSessionRemove-RDMUserRemove-RDMUserRoleSet-RDMCurrentDataSourceSet-RDMDataSourceSet-RDMDataSourcePropertySet-RDMRoleSet-RDMRolePropertySet-RDMSecurityGroupPropertySet-RDMSessionSet-RDMSessionDomainSet-RDMSessionPasswordSet-RDMSessionPropertySet-RDMSessionUserNameSet-RDMUserSet-RDMUserGroupRightsSet-RDMUserPropertySet-RDMUserSecurityUpdate-RDMUI
Old CmdLetClose-RDM-SessionGet-RDM-DataSourceGet-RDM-DomainGet-RDM-PasswordGet-RDM-PropertyGet-RDM-SecurityGroupGet-RDM-SessionGet-RDM-TemplateGet-RDM-UserNameNew-RDM-SecurityGroupNew-RDM-SessionOpen-RDM-SessionRemove-RDM-SessionSet-RDM-DataSourceSet-RDM-DomainSet-RDM-PasswordSet-RDM-PropertySet-RDM-SecurityGroupSet-RDM-SessionSet-RDM-UserName
Stéfane Lavergne
RDM-Help.xml