Import .rdm file into Devolutions Hub Business

Import .rdm file into Devolutions Hub Business

avatar

Good afternoon,

Is it possible to import the content of an .rdm file into a Hub Business environment using PowerShell?

Kind regards,

Ron Bouwmeester

avatar

Recommended Answer

Hello Ron,

Your script is on the right track, but there are a few things to fix:

  • Missing Set-RDMCurrentDataSource: After retrieving the data source, you need to actually activate it. Without this call, all subsequent commands run against whatever data source was already active.
  • Missing validation: After setting the data source and vault, it is good practice to verify they are correctly active before proceeding. This prevents silently importing into the wrong location.
  • Import-RDMEntry missing -Set: Without -Set, the documents and attachments will not be included.


Here is the corrected script:

  $desiredDataSourceName = "Devolutions Hub Business"
  $desiredVaultName      = "<Vault name>"

  # 1. Get and activate the data source
  $ds = Get-RDMDataSource -Name $desiredDataSourceName
  Set-RDMCurrentDataSource $ds

  # 2. Validate the active data source
  $currentDs = Get-RDMCurrentDataSource
  if ($currentDs.Name -ne $desiredDataSourceName) {
      Write-Error "Data source mismatch: expected '$desiredDataSourceName', got '$($currentDs.Name)'. Aborting."
      exit 1
  }

  # 3. Get and activate the vault
  $repository = Get-RDMRepository -Name $desiredVaultName
  Set-RDMCurrentRepository $repository

  # 4. Validate the active vault
  $currentRepo = Get-RDMCurrentRepository
  if ($currentRepo.Name -ne $desiredVaultName) {
      Write-Error "Vault mismatch: expected '$desiredVaultName', got '$($currentRepo.Name)'. Aborting."
      exit 1
  }

  # 5. Import entries
  $importedEntries = Import-RDMEntry -Path "<Path>\<FileName>.rdm" -Set
  Write-Host "Imported $($importedEntries.Count) entries."


This script has been tested and works correctly. Just replace <Vault name>, <Path>, and <FileName> with your actual values.

Best regards,
Maxime

All Comments (6)

avatar

Hello,

Yes, it is possible to import the content of an .rdm file into a Hub Business environment using PowerShell. You can use the Import-RDMEntry cmdlet , which supports both .rdm and .json files.

Do not hesitate to reach out if you have any further questions, or let us know if you would like a step-by-step example.

Best regards,
Maxime

avatar

Hello Maxime,

Thank you very much for your reply.

Do you perhaps have an example script?

Thank you in advance for your reply.

Kind regards,

Ron Bouwmeester

avatar

Hello Maxime,

I have created the following script:

$ds = Get-RDMDataSource -Name "Devolutions Hub Business"

$repository = Get-RDMRepository -Name ",Vault name>" ;Set-RDMCurrentRepository $repository

Import-RDMEntry -Path "<Path>\<FileName>.rdm"

Is this the correct way?

Kind regards,

Ron Bouwmeester

avatar

Hello Ron,

Your script is on the right track, but there are a few things to fix:

  • Missing Set-RDMCurrentDataSource: After retrieving the data source, you need to actually activate it. Without this call, all subsequent commands run against whatever data source was already active.
  • Missing validation: After setting the data source and vault, it is good practice to verify they are correctly active before proceeding. This prevents silently importing into the wrong location.
  • Import-RDMEntry missing -Set: Without -Set, the documents and attachments will not be included.


Here is the corrected script:

  $desiredDataSourceName = "Devolutions Hub Business"
  $desiredVaultName      = "<Vault name>"

  # 1. Get and activate the data source
  $ds = Get-RDMDataSource -Name $desiredDataSourceName
  Set-RDMCurrentDataSource $ds

  # 2. Validate the active data source
  $currentDs = Get-RDMCurrentDataSource
  if ($currentDs.Name -ne $desiredDataSourceName) {
      Write-Error "Data source mismatch: expected '$desiredDataSourceName', got '$($currentDs.Name)'. Aborting."
      exit 1
  }

  # 3. Get and activate the vault
  $repository = Get-RDMRepository -Name $desiredVaultName
  Set-RDMCurrentRepository $repository

  # 4. Validate the active vault
  $currentRepo = Get-RDMCurrentRepository
  if ($currentRepo.Name -ne $desiredVaultName) {
      Write-Error "Vault mismatch: expected '$desiredVaultName', got '$($currentRepo.Name)'. Aborting."
      exit 1
  }

  # 5. Import entries
  $importedEntries = Import-RDMEntry -Path "<Path>\<FileName>.rdm" -Set
  Write-Host "Imported $($importedEntries.Count) entries."


This script has been tested and works correctly. Just replace <Vault name>, <Path>, and <FileName> with your actual values.

Best regards,
Maxime

avatar

Hello Maxime,

This works perfectly.

Thank you very much for your support.

Kind regards,

Ron Bouwmeester

avatar

Hello Ron,

You are welcome! Please reach out to us if you need anything else.

Best regards,
Maxime