Powershell Import-RDMSession - error import session from json

Powershell Import-RDMSession - error import session from json

avatar

Hi,

I'm trying to automatically create connections, unfortunately I'm having a bit of trouble finding full documentation for the powershell module.

The integrated documentation is quite extensive, but for Import-RDMSession I'm missing an example of how the json might look, as currently I'm running into the following error:

$sessions = Import-RDMSession -Path /tmp/import.json

Import-RDMSession: Object reference not set to an instance of an object.

My json looks like this:

{

       "Host": "example.domain.tld",

       "Name": "Example Host",

       "Group": "Name of top folder",

       "Description": "Description of the host",

       "Template": "Name of the Template"

}

I can create Hosts with New-RDMSession, so I guess the connection to the database and everything works fine

All Comments (7)

avatar

Hello,

Here is the online documentation about the JSON file format. Sadly, there is no sample file on that page. I'll ask our documentation team to add one.

The best method for knowing how the JSON file should be built is to export an entry as a JSON file and then use this model to create your own JSON files.

Let us know if that helps.

Best regards,

Érica Poirier

avatar

Unfortunately that doesn't include a lot of fields.

Could you tell me why the error appears during import?

How can I export as json? I don't see an option for that neither in the UI, nor in the Powershell Module

thanks

avatar

Hello,

Thank you for your response.

Could you please check if the option to export in JSON format is available by going to File > Export?

This could provide you with an example of how the JSON export looks.

In the meantime, here’s a sample of what a typical JSON file might look like:

{

"Host": "server.domain.com",

"Name": "Server Connection",

"Group": "Servers",

"Description": "Production server",

"Template": "RDP Template",

"Type": "RDP",

"Port": 3389,

"Username": "user",

"Domain": "domain",

"Password": "password",

"Protocol": "RDP"

}

Let me know if this helps.

Best regards,

Tommy Sanders

avatar

Hello,

On what OS are you using RDM?

Here is another JSON file format sample:

{
    "Connections":
    [
        {
            "Url":"192.192.192.192",
            "ConnectionType":1,
            "Description":"This is the description!",
            "Group":"MyFolder",
            "Name":"TestRDP",
            "OpenEmbedded":true,
            "TemplateSourceID":"651ef84a-a2c6-4679-902a-942e13cc4048",
            "RDP":{}
        }
    ]
}

Let me know if that helps.

Best regards,

Érica Poirier