Good afternoon,
Is it possible to import the content of an .rdm file into a Hub Business environment using PowerShell?
Kind regards,
Ron Bouwmeester
Recommended Answer
Hello Ron,
Your script is on the right track, but there are a few things to fix:
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
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
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
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
Hello Ron,
Your script is on the right track, but there are a few things to fix:
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
Hello Maxime,
This works perfectly.
Thank you very much for your support.
Kind regards,
Ron Bouwmeester
Hello Ron,
You are welcome! Please reach out to us if you need anything else.
Best regards,
Maxime