Powershell: move session to vault

Powershell: move session to vault

avatar

Hi guys,

I'm trying to move an RDM Session to another vault with powershell. I found someone else trying to copy to another vault but I really want to move. Hopefully without switching from and to that vault because I've 300+ to move and I don't want it to take too long.

This is what I have so far

Import-Module 'C:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShellModule.psd1'
Add-Type -AssemblyName PresentationFramework

Write-Host -ForeGroundColor Yellow "Loading RDM data, please be patient" 

# Speed up testing by not loading all RDM sessions every time
If ($Null -eq $AllSessions) {
    $AllSessions = Get-RDMSession
}

$ExpiredStatusID = "{7B926104-9C7E-4c91-BDAC-DFCCC36B8D70}"
$ExpiredSessions = $AllSessions | ? { $_.status -eq $ExpiredStatusID }

$x = $ExpiredSessions | Select -First 1

$ObsoleteVault = Get-RDMVault -Name "Obsolete"

# Here goes the code that moves $x to $ObsoleteVault



Best regards,
Thomas

All Comments (9)

avatar

Hello,

this should be fulfil your request - this will be move (because of the DontChangeID Option) from the current datasource to the $ObsoleteVault

Please create a backup before you run this script!

...
# Here goes the code that moves $x to $ObsoleteVault

$move = Copy-RDMSession -DontChangeID -PSConnection $x
$ObsoleteVault = Get-RDMVault -Name Obsolete
Set-RDMCurrentRepository $ObsoleteVault
Set-RDMSession $move
Update-RDMUI


Regards,
Min

avatar

Thanks Min, I'll try it out today!

avatar

Okay, that worked after updating RDM to the latest version and using the Powershell Gallery module.

BUT

When trying to move sessions of the type DataEntry, I get WARNING: Unable to save the entry; access denied and I'm logged in as an administrator to the datasource and both vaults

avatar

Hi,

I'll look into this issue and update this thread once I know more.

Regards

Jonathan Lafontaine

avatar

101 Funny Thank You Memes to Say Thanks for a Job Well Done | Funny thank  you, Thank you memes, Funny thank you quotes

avatar

Hi Thomas,

I was able to reproduce your issue and have a fix.
However, the initial fix revealed a bug in RDM that would prevent your moved entries from loading correctly.
That means this issue will require an simultaneous update of the PowerShell module and RDM Windows.
I will update this thread once more when everything is available online.

Regards

Jonathan Lafontaine

avatar

Hi Jonathan,

Thank you very much! I was working in a testing environment and we need still need to upgrade all RDM installations on the laptops of our engineers so the extra update is no problem for me.

Best regards,
Thomas

avatar

Hi Thomas,

RDM 2021.2.25.0 has just been released. Combined with PowerShell 2021.2.0.32, you should now be able to move your credential entries to a different vault without any issue.
If this is not the case, let me know.

Regards

Jonathan Lafontaine

avatar

Goodmorning Jonathan,

Thank you! I'll check it out but I assume it'll be fine.

Best regards,
Thomas