Resolving RDM variables in PowerShell

Implemented

Resolving RDM variables in PowerShell

avatar

Is there any example, how to resolve RDM variables used in RDM sessions, when accessing sessions using PowerShell module? Right now the PowerShell returns sessions with variable names in fields as is.

Or is it possible to get the same information without resolving RDM variables?

IIRC when exporting sessions with RDM variables to CSV file, the variables are also left unresolved.

All Comments (10)

avatar

Hello,

I don't think there is any switch or method to resolve RDM variables when accessing them through the RDM PowerShell module. I will verify with the engineering team if we can improve it.

About the export to CSV file, using the Export-RDMSession cmdlet with the -CSV switch, the variables are resolved.

What RDM version and RDM PowerShell version are you using?

What data source type are you using?

Best regards,

Érica Poirier

avatar

RDM version: 2022.3.31.0
PowerShell module: 2022.3.1.3

Export-RDMSession does export something like .zip file instead of CSV. And for some strange reason it thinks that relative paths should be based on module folder, not current working directory

PS C:\folder❯ Export-RDMSession -CSV -Path '.\hosts.csv' -Sessions $sessionList -Password $password
Export-RDMSession : Access to the path 'C:\Program Files\WindowsPowerShell\Modules\RemoteDesktopManager\2022.3.1.3\hosts.csv' is denied.

and using only filename does not work at all.

PS C:\folder❯ Export-RDMSession -CSV -Path 'hosts.csv' -Sessions $sessionList -Password $password
Export-RDMSession : Path cannot be the empty string or all whitespace.
avatar

Is there any description of objects returned by Get-RdmSession cmdlet? Can't find, where is located the IP address and Host from Asset information screen.

avatar

Hello,

Is there any description of objects returned by Get-RdmSession cmdlet? Can't find, where is located the IP address and Host from Asset information screen.


For finding the location of a field, the preview in the clipboard copy is recommended. Right-click on the entry where the desired fields have value and select Clipboard - Copy. Go in the preview tab and spot the fields. The structure will indicate where the field is located. In your case, it will be $entry.MetaInformation.IP and $entry.MetaInformation.MachineName.

forum image

Export-RDMSession does export something like .zip file instead of CSV.


The CSV export is contained within a password encrypted zip file for security reason.

And for some strange reason it thinks that relative paths should be based on module folder, not current working directory


For the default relative path based on the module, it will investigated. For the moment, you can get your present Path with Get-Location.

avatar

Hello,

Thank you for the information.

For the relative paths, I have submitted a ticket to our engineering team. Once a fix will be available, we will update this thread.

Regarding the details of the connection object returned by Get-RDMSession, we do not have any online documentation. The parameter you are looking for is located in MetaInformation section. It should be like this.

$session.MetaInformation.IP
$session.MetaInformation.MachineName


You can find more information about how to get entry structure on the following article.
https://help.remotedesktopmanager.com/pstipsandtricks.html

Best regards,

Érica Poirier

avatar

Thanks. It would be nice to have at least something documented. It is a bit difficult to scan forums and then ask for every next bit of information needed. I would prefer the documentation.

avatar
The CSV export is contained within a password encrypted zip file for security reason.


It would be nice to have option to export data without encrypting it. For example when I want only export hostname and IP (and no passwords) to use that information elsewhere, the encryption makes Export-RdmSession unsuitable. Also, it would be nice, to add that fact (and the fact that -Password parameter is mandatory) into documentation.

avatar

Hello,

Thank you for your feedback.

For now, the better method to find out the property name is to add a value or enable the property and verify in right-click on the entry in RDM and then go in Clipboard - Copy - Preview.

forum image

About exporting in a CSV file without encryption, the engineering team will analyze if it's possible or not to implement this possibility and they will keep you posted.

Thank you for your patience.

Best regards,

Érica Poirier

avatar

Hi,

There is a way to resolve a session's variables.
Here's an example

$s = Get-RDMSession -Name "some name"
$s2 = Copy-RDMSession $s -ResolveVariables
$s2.MetaInformation.MachineName


RDM's backend always creates a clone when resolving variable so calling Copy-RDMSession is as efficient as it can be.
The cloned session will only live in memory as long as you don't call Set-RDMSession.

Let me know if this helps with your initial issue.
Regards

Jonathan Lafontaine

avatar
There is a way to resolve a session's variables.


Thanks, I will try that.

Meelis