Forum / Remote Desktop Manager - PowerShell Repository

[RESOLVED] Export all credentials entries of all repositories

  • Create an Issue
  • Cancel

Dear,

We are using a lot of different repositories in RDM Enterprise.
We have in each repository a folder "Credentials".

Is there a way to export/backup all entries of this folder, from all repositories ?

Actually, we see that the option is available with a right click on the folder directly and select "export ..." but it will take us too much time to do that for all our repositories.

Thank you in advance for your support.

Clock6 mths

Hello,

It is possible using the RDM PowerShell module to build a script to export the Credentials folder across all repositories.

Here is a sample script you can use to export the entries located in the Credentials folder of each repository. It will create one file per repository. You will have to adapt the data source name, the password and the destination path in the script.

If you are not familiar with the RDM PowerShell module, the computer which will run the script must have RDM installed. And the data source the script will connect to must exist in the user's profile that will run the script.

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

# Adapt the data source name
$ds = Get-RDMDataSource -Name "NameOfYourDataSourceHere"
Set-RDMCurrentDataSource $ds

# Adapt the password
$passwd = ConvertTo-SecureString -AsPlainText -Force 'mypassword'

$repos = Get-RDMRepository

foreach ($repo in $repos)
{
Set-RDMCurrentRepository $repo
Update-RDMUI

$sessions = Get-RDMSession | where {$_.Group -eq "Credentials"}
$reponame = $repo.name

# Adapt the destination path for the file(s)
Export-RDMSession -Path "C:\temp\Sessions_$reponame.zip" -Sessions $sessions -CSV -Password $passwd
}

Best regards,



Érica Poirier

signaturesignature

Clock6 mths

Hi,

Thank you for your answer.
It works well but only if credential entries are directly under the folder "Credentials".

We are using exclusively the credential entry "Username / Password" in RDM.
So is it possible to set the condition not on the folder name but on the RDM type object "Username/Password" ?

I mean modify the line
$sessions = Get-RDMSession | where {$_.Group -eq "Credentials"}
To something like
$sessions = Get-RDMSession | where {$_.Type -eq Username/Passwords}


Also, is it possible to export the same data in csv or html file ?
Command Export-RDMSession -Path "C:\temp\Sessions_$reponame.zip" -Sessions $sessions -IncludeCredentials -CSV -Password $passwd
} seems doesn't work here ...
But maybe we forget something.

Thank you in advance for your support.

Clock6 mths

Hello,

If you don't mind, as we are talking about the PowerShell module, I will move this thread in the PowerShell section.

Yes it is possible to work with only Credentials entry type with the following command.

$sessions = Get-RDMSession | where {$_.ConnectionType -eq "Credential"}

About the Export-RDMSession, only the XML file can contains the credentials and be password protected. Here is a sample of the command.

Export-RDMSession -Sessions $sessions -XML -Path "C:\Temp\export.rdm" -Password $pwd -IncludeCredentials

Best regards,



Érica Poirier

signaturesignature

Clock6 mths

Hi Ercia,

Thanks again for your support.
Sounds OK for me but I'm a little bit surprised by the fact we can't export this kind of data in a CSV/HTML/XLS file with usernames and passwords, because it's possible if we do that manually in the RDM interface with "Export Special" option (but we have to do that on all repositories ...).

The final goal here was to have an export of all RDM credentials entries in an independent file we can open without a specific software, as a backup.
This file will be secure by different other ways so the password protection is not important for us here.
Is there any solution for that ?

Clock6 mths

Hello,

After having a discussion with an engineer about this behavior, it is possible to export the passwords of any credential entries in a CSV file using the Export-RDMSession cmdlet. We must not use the -IncludeCredentials switch. Only when exporting into XML file that we need to specify that switch.

I will adapt the script above.

Best regards,



Érica Poirier

signaturesignature

Clock6 mths

Dear Erica,

Thanks a lot for your support !
It works now very well.

So here is the last version of our script :

Import-Module 'C:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShellModule.psd1'
# Adapt the data source name
$ds = Get-RDMDataSource -Name "%YourDatabase-RDM%"
Set-RDMCurrentDataSource $ds
# Adapt the password
$passwd = ConvertTo-SecureString -AsPlainText -Force '%yourpassword%'
$repos = Get-RDMRepository
foreach ($repo in $repos)
{
Set-RDMCurrentRepository $repo
Update-RDMUI
$sessions = Get-RDMSession | where {$_.ConnectionType -eq "Credential"}
$reponame = $repo.name
# Adapt the destination path for the file(s)
Export-RDMSession -Path "C:\temp\Sessions_$reponame.zip" -Sessions $sessions -CSV -Password $passwd
}


Again, thanks a lot !

Clock6 mths

Hello,

Thank you for your feedback and glad that it's working well now!

Best regards,



Érica Poirier

signaturesignature

Clock6 mths