Forum / Remote Desktop Manager - PowerShell Repository

Do remote powershell using RDM as inventory source

  • Create an Issue
  • Cancel

Hi,

I want to make a simple "Get-Process" on some hosts using RDM as inventory source.

The problem is to retrieve credentials. With the GUID, I can copy username and password. With powershell, I get an access denied (get-RDMSessionPasword)
What is the good way to get login/password or credientials (the best way I think) like the Get-credential return object ?


$sessions = Get-RDMSession -Group $group | where {$_.connectionType -ne "Group"}
foreach ($h in $sessions) {
$p = Get-RDMSessionPassword $h # access denied
$c = Get-RDMSessionCredentials -PSConnection $h # return a simple string like 'privatevaultsearch', or 'inherited', or 'credentialEntry', or 'SEssionspecific'. Not a credential
}

I don't want to use the RDM agent, sorry. I'm using Remote Powershel and ansible for some tasks.

Thanks you

Clock4 mths

Hello,

About the Get-RDMSessionPassword access denied, does the account who run the script has enough permission to view passwords?

What RDM version are you using?

What data source type are you connected to?
If it is Devolutions Password Server, what version are you using?

Best regards,



Érica Poirier

signaturesignature

Clock4 mths

Erica Poirier wrote:

Hello,

About the Get-RDMSessionPassword access denied, does the account who run the script has enough permission to view passwords?

What RDM version are you using?

What data source type are you connected to?
If it is Devolutions Password Server, what version are you using?

Best regards,

no, I can juste copy password (But I can copy un a notepad and view the password)

Clock4 mths

Hello,

What RDM version are you using?

What data source type are you connected to?

Best regards,



Érica Poirier

signaturesignature

Clock4 mths

Version 14.1.3.0
Datasource is SQL.

What is the function 'Get-Credential' about ?? Why don't write a RDM function that return a Credential object ?? We can't get the password with a credential object if you think about security

Clock4 mths

Hello,

The Get-Credential cmdlet will prompt for credentials and you can save the information in a variable like this :

$mycreds = Get-Credential

To get the credentials of a RDM entry and save it in a variable as a credential object, you can use the Get-RDMSessionCredentials cmdlet.

$session = Get-RDMSession -Name "MyRDPConnection"
$credentials = Get-RDMSessionCredentials -PsConnection $session

Best regards,



Érica Poirier

signaturesignature

Clock4 mths

Thanks you, but it doesn't work

This is the code :


$repo = "MyRepo"
$group = "MyGroup"

$RDMrepo = Get-RDMRepository -Name $repo
Set-RDMCurrentRepository -Repository $RDMrepo
$sessions = Get-RDMSession -Group $group | where {$_.connectionType -ne "Group"}

foreach ($s in $sessions) {
$credentials = Get-RDMSessionCredentials -PsConnection $s
Invoke-Command -ComputerName $s.Host -Credential $credentials -ComputerName $s.Host -ScriptBlock { Get-PSDrive }
}

error :


Invoke-Command : Cannot process argument transformation on parameter 'Credential'. userName
At C:\XXX\list_hosts.ps1:14 char:54
+ ... Invoke-Command -ComputerName $s.Host -Credential $credentials -Comput ...
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (smile [Invoke-Command], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Microsoft.PowerShell.Commands.InvokeCommandCommand

Clock4 mths

Hello,

Thank you for your feedback.

I had a discussion with an engineer and the Get-RDMSessionCredentials cmdlet will either return the session credentials ID or the credential type in which are saved the username and password.

So we are still looking on how to resolve the main issue as you will have to use the Get-RDMSessionUsername and Get-RDMSessionPassword cmdlets.

Could you please go in File - My Data Source Information and send the report using the small envelop on the top right corner? Please add a reference to this forum thread in the Message section.

Best regards,



Érica Poirier

signaturesignature

Clock4 mths

Done

Clock4 mths

Hello,

Thank you for the report.

With the same user account configuration, I am unable to reproduce the issue and can get the username/password of any entries with Get-RDMSessionUsername or Get-RDMSessionPassword.

What entry type are you trying to get the credentials?

What is the value set for the entry's Credentials property?

Best regards,



Érica Poirier

signaturesignature

Clock4 mths