Using PS to refresh credential entries in the GUI after updating them via PS

Using PS to refresh credential entries in the GUI after updating them via PS

avatar

Due to daily password rotations for multiple accounts, I'm using PowerShell to automate a lot of this process. Below is the RDM portion of my code that updates RDM, which works well:

$MySession = Get-RDMSession | Where { $_.Name -eq $username }
Set-RDMSessionPassword -Session $MySession -Password $Password
Set-RDMSession $MySession

However, if RDM is currently open, like it normally is, I have to force a refresh of the GUI in order for it to pick up the new passwords. I cannot find an RDM PS cmdlet to force this refresh - does one not exist? My workaround is to enable "Auto refresh" on the SQLite Local Data Source (set to 30), but I'm not sure what else that will affect, since I just enabled it. If there's a way to refresh the GUI via PS, I'd love to hear it.

All Comments (22)

avatar

Hi,

Update-RDMUI will tell a running RDM instance to refresh its data.

Let me know if this works.
Regards

Jonathan Lafontaine

avatar

Sorry, I should have noted in my previous post that I have tried using Update-RDMUI, but it doesn't seem to work for me. The command doesn't error out, but if I edit the credential entry it shows the old password, or if I launch a session, it fails with a bad password.

avatar

Which version of RDM and the PS module are you using?

Jonathan Lafontaine

avatar

RDM: 2022.3.35.0
RDM PS: 2022.2.3.0

avatar

For maximum compatibility, you want to keep your RDM and PS major (2022) and minor (3) synced.
In this case, simply updating to the latest version of the module is ok.

We worked on the communication between RDM and the module around those time.
It's possible Update-RDMUI is doing nothing right now.

Jonathan Lafontaine

avatar

Okay, so updating the PS module to 2022.3.1.8 is acceptable? I didn't want to risk my script breaking and then me having to go back and correct things.

avatar

There is always a risk but the 2022.3.1 release has a good bit of mileage and was patched along the way.

Jonathan Lafontaine

avatar

That did the trick, thank you for the quick assistance!

avatar

My pleasure!

Jonathan Lafontaine

avatar

My script has been working fine since this update, and I have recently updated RDM to 2023.1.29 (on 7/3). This morning, my script failed to update the GUI (RDM was running), and I saw the following error: [Error] The operation has timed out.

I added Update-RDMUI to my script above like I said, which worked fine until today. So instead I commented that out and added -Refresh at the end of the Set-RDMSession command - same error. Any idea why that would be? I rarely close RDM and would prefer not having to do so in order to update my passwords.

avatar

Hello,

From version 2023.1.0.0, the RemoteDesktopManager module has been renamed to Devolutions.PowerShell. So it recommended that you use the module Devolutions.PowerShell v2023.1.0.10 after your RDM upgrade.

If this error occurs after the upgrade, or it has been already upgraded, let us know so we will investigate further.

avatar

Well, awesome. Do I need to remove the old RemoteDesktopManager module before installing this new one? I assume the same cmdlets are going to be used?

avatar

The Devolutions.PowerShell module requires PS7.2 to run, while I'm using PS 5.1. I have no intention of switching to 7 right now, so is the answer here to simply roll back RDM to an earlier build?

avatar

The RemoteDesktopManager module is the last one to fully support PS 5.1, so you would have to roll back your RDM version.

Well, awesome. Do I need to remove the old RemoteDesktopManager module before installing this new one? I assume the same cmdlets are going to be used?


For your information, the cmdlets are the same. It is recommended to remove RemoteDesktopManager module when changing to Devolutions.PowerShell.

avatar

My issue is that the script I wrote also updates my KeePass DB, which does not support PS 7. What version of RDM would I need to roll back to in order to continue using PS 5?

avatar

Hello,

Version 2022.3.1.8 of the RemoteDesktopManager PowerShell module is the latest version which still runs on PS5.

But you'll have to downgrade your RDM as well to version 2022.3.35 and depending on your data source, that might cause some problems.

Let us know how it goes.

Best regards,

Érica Poirier

avatar

I was able to uninstall 2035.x and install 2022.3.35. My script appears to be working again, so I guess I'm going to have to live with this particular build of RDM forever. I appreciate the assistance.

avatar

Circling back to this very old post, is there a new method for refreshing the RDM GUI while open in the latest build (2024.3.8.0) using the latest Devolutions.PowerShell PS module (2024.3.8) in PS7? I'm basically trying to use my old script with the new PS module, and am running into this old problem:

$MySession = Get-RDMSession | Where { $_.Name -eq $username }
Set-RDMSessionPassword -Session $MySession -Password $Password
Set-RDMSession $MySession -Refresh

I have tried replacing that Set-RDMSession with Update-RDMUI, and have even just added it after the fact, but it doesn't consistently refresh the opened RDM GUI like the old method did.

avatar

Hello,

Thank you for your feedback.

If you want to update the RDM UI while running a PS script, you can use the Update-RDMUI cmdlet. However, you need to keep the Set-RDMSession as it saves the modification you want to do.

Let us know if that helps.

Best regards,

Érica Poirier

avatar

Yeah, definitely not working right now. I'm running this right now without success:

Set-RDMSession $MySession -Refresh
Update-RDMUI

The GUI won't update unless I edit the entry and click on the Update button.

avatar

I can't explain it, but this combination seems to work:

$MySession = Get-RDMSession | Where { $_.Name -eq $username }
Set-RDMSessionPassword -Session $MySession -Password $Password -Refresh
Set-RDMSession $MySession -Refresh
Update-RDMUI
avatar

Hello,

Thank you for your feedback.

The only difference is the -Refresh switch on the Set-RDMSessionPassword cmdlet. It seems that if the password is involved in the script, we must refresh it from PowerShell to get a successful refresh using the Update-RDMUI cmdlet.

Best regards,

Érica Poirier