hi,
is it possible to get entries from one vault (using Get-DSEntry) and "import" them into another one? using New-DSBaseEntry maybe?
I tried the following but get an error: New-DSEntryBase: Object reference not set to an instance of an object
$copyEntry = Get-DSEntry -EntryId $idToCopy $copyEntry.repositoryId = $destinationVault.ID New-DSEntryBase -JsonBody (ConvertTo-Json -InputObject $copyEntry -Depth 10)
KR
G.
Hello,
Thank you for reaching out regarding this matter.
The JSON round-trip appears to be the source of the issue. Get-DSEntry without the -AsRDMConnection parameter returns a partial object that does not survive ConvertTo-Json cleanly, which is causing the null reference error.
Please try the following instead:
$entry = Get-DSEntry -EntryId $idToCopy -SearchAllVaults -AsRDMConnection $copyEntry = $entry.ConnectionInfo $copyEntry.ID = [guid]::NewGuid() $copyEntry.RepositoryID = $destinationVault.ID New-DSEntryBase -FromRDMConnection $copyEntry
New-DSEntryBase -FromRDMConnection accepts the entry object directly, so there is no need to convert it to JSON. Please note that the actual entry data is nested under .ConnectionInfo.
I recommend testing this approach on a non-critical entry first to confirm that it behaves as expected.
Please let me know if you have any further questions.
Best regards,
Jacob Lafrenière
hi @Jacob Lafrenière,
while this works fine when running it the first time - every other run fails.
The source entries are corrupt after that and Get-DSEntry -EntryID $idToCopy -VaultID $sourceVault.ID as well as using the browser to navigate to the source vault return "Object not found".
Can this be fixed somehow? maybe the Data property has to also be manipulated?
KR
G.
def887e1-b257-4b09-a442-e55c68f0e7e8.png