Forum / Remote Desktop Manager - PowerShell Repository

How to update the username and/or password of a Credential

  • Create an Issue
  • Cancel

is there a way via PowerShell to get and/or update the username/password of a credential?
Again, a credential, not a session object.

Clock24 days

Hello,

Yes there is.
The cmdLet Get-RDMSession will return any session or credentials.

I created a Credential entry named "ReuvensCreds"

$s = get-rdmsession -name "ReuvensCreds" # will store the session entity in $s

# You can then get the data for the domain and username by using :
$s.HostDomain
$s.HostUsername

# These fields can be updated using this :
$s.HostDomain = "NewDomain"

$s.HostUsername = "NewUsername"
Set-RDMSession $s

# For the password get/set there is another cmdlet to use
# Display the password : get
Get-RDMSessionPassword -Session $s -AsPlainText

Output : Password1

# To set the password :
Set-RDMSessionPassword -Session $s -Password (ConvertTo-SecureString "Password2" -AsPlainText -force)
Set-RDMSession $s


On a side note, when you have a session referring to a Credential Entry, you can use the Get-RDMSessionCredentials to get to this entry, like :
# Get a RDP referring to the Credential entry
$rdp = Get-RDMSession -name "ReuvensRDP"
$credID = Get-RDMSessionCredentials -PSConnection $r -GetID

# And access the object :
$s = Get-RDMSession | ? {$_.ID -eq $credID}

I hope this helps|


Best regards,



Alex Belisle

signaturesignature

Clock23 days