I have a bunch of local VMs that I create and cleanup via scripts. They are running on a HyperV Default switch and get ephemeral IP addresses. I have a Powershell script that looks at Session entries in RDM, compares the names of running VMs and looks if the IP address matches. If not, it updates the Host field in the session to the new IP.
The issue that I am having is that Update-RDMUI does not work to get the running RDM instance to update the Host entry. Its working for Metadata that I change, or when I remove a session entry.
I am running:
RDM 2025.3.30.0
Devolutions.PowerShell 2025.3.3
I tried:
$rdmSession = Get-RDMSession -Name $($vm.Name) $rdmSession.Host = $ipAddress Set-RDMSession -Session $rdmSession -Refresh Update-RDMUI
I also tried:
$rdmSession = Get-RDMSession -Name $($vm.Name) Set-RDMSessionProperty -ID $rdmSession.ID -Property Host -Value $ipAddress -Refresh Update-RDMUI
I also tried the Property "Url", instead of host.
I tried to run Update-RDMEntries or Update-RDMRepository before the UI update. Nothing refreshes the UI of the running instance. If I am clicking on the refresh in the instance, it reloads correctly.
It would be great if there would be a way to trigger the "Reload (F5)" function from Powershell in the UI.
Hello vendolis,
Thank you for reaching out to the Devolutions support team.
Could you try this function?
function Invoke-RDMReloadF5 {
[CmdletBinding(SupportsShouldProcess)]
param(
# If you run multiple RDM instances, you can optionally target by window title.
[string]$WindowTitleLike = "Remote Desktop Manager*",
# Small delay to let RDM process the entry update before forcing reload
[int]$PreKeyDelayMs = 200
)
Add-Type -AssemblyName System.Windows.Forms
$sig = @"
using System;
using System.Runtime.InteropServices;
public static class User32 {
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
}
"@
Add-Type -TypeDefinition $sig -ErrorAction SilentlyContinue | Out-Null
$SW_RESTORE = 9
$rdmProc = Get-Process -ErrorAction SilentlyContinue |
Where-Object {
$_.MainWindowHandle -ne 0 -and
$_.MainWindowTitle -like $WindowTitleLike -and
$_.ProcessName -like "RemoteDesktopManager*"
} |
Sort-Object StartTime -Descending |
Select-Object -First 1
if (-not $rdmProc) {
throw "Could not find a running Remote Desktop Manager window (ProcessName like 'RemoteDesktopManager*', Title like '$WindowTitleLike')."
}
if ($PSCmdlet.ShouldProcess("RDM PID $($rdmProc.Id) [$($rdmProc.MainWindowTitle)]", "Activate window and send F5 (Reload)")) {
[User32]::ShowWindowAsync($rdmProc.MainWindowHandle, $SW_RESTORE) | Out-Null
Start-Sleep -Milliseconds 50
[User32]::SetForegroundWindow($rdmProc.MainWindowHandle) | Out-Null
Start-Sleep -Milliseconds $PreKeyDelayMs
[System.Windows.Forms.SendKeys]::SendWait("{F5}")
}
}
$rdmSession = Get-RDMSession -Name $vm.Name
$rdmSession.Host = $ipAddress
Set-RDMSession -Session $rdmSession -Refresh
# Your existing attempts:
Update-RDMEntries -ErrorAction SilentlyContinue
Update-RDMUI -ErrorAction SilentlyContinue
# Fallback that behaves like pressing Reload (F5):
Invoke-RDMReloadF5
This small script will provide the information on whether the -refresh and the update command refresh your RDM or not.
Best regards,
Patrick Ouimet
Hi Patrick,
this approach partially worked. Since I need to use PowerShell 7 (due to other requirements in the script where it is in) the function does not work. If changing the code to activate the window and sending the key to the following, it does work:
$wshell = New-Object -ComObject WScript.Shell
$wshell.AppActivate($rdmProc.MainWindowTitle)
Start-Sleep -Milliseconds $PreKeyDelayMs
$wshell.SendKeys("{F5}")
But I found a better solution, based on this, that does not require the window to be placed in the foreground.
The Add-Type block needs to be changed to:
$sig = @"
using System;
using System.Runtime.InteropServices;
public static class User32 {
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
}
"@
Add-Type -TypeDefinition $sig -ErrorAction SilentlyContinue | Out-NullAnd then the block in the bottom reads:
if ($PSCmdlet.ShouldProcess("RDM PID $($rdmProc.Id) [$($rdmProc.MainWindowTitle)]", "Send F5 (Reload) to RDM process")) {
# Get the main window handle
$hwnd = $rdmProc.MainWindowHandle
# Windows message constants
$WM_KEYDOWN = 0x0100
$WM_KEYUP = 0x0101
$VK_F5 = 0x74 # Virtual key code for F5
# Send F5 key press
[User32]::SendMessage($hwnd, $WM_KEYDOWN, [IntPtr]$VK_F5, [IntPtr]0) | Out-Null
[User32]::SendMessage($hwnd, $WM_KEYUP, [IntPtr]$VK_F5, [IntPtr]0) | Out-Null
}This worked for me as well.
I have also been able to reproduce the issue with "Update-RDMUI". It works when I am in a PowerShell, the RDM window is open and I run the Update-RDMUI for the first time. If I close the UI and reopen it, it will not work anymore. I would assume that it lost its handle and does not get reconnected. If I open another new Powershell and run the command there, it again works.
Thanks a lot
Hello vendolis,
Thank you for this feedback.
What you describe makes sense.
Since PowerShell and RDM are not considered the same instance, when you connect to your data source, it connects to RDM.
If you close it (RDM UI), you will need to reconnect to the active session to use the Update-RDMUI.
Best regards,
Patrick Ouimet
Hi Patrick,
yes, that i what I assumed. How do you reconnect it? I did not find a command that I could run to do it.
As the conenction is done implicitly when running the first command, and the function does not throw any errors, it's hard to check for that.
Since I dont need to attach to a RDM instance to run a comand i would exspect that if an instance does not exist anymore, it would either give an error, or (as it does in the beginning) it looks if there is another running RDM instance and connects to that one in the same way as it does when you run the module for the first time.
Thanks
Hello Vendolis,
Currently, there is no specific PowerShell command in Devolutions.PowerShell module to "reconnect" or "reattach" to an active RDM instance after the user interface (UI) has been closed and reopened. As you have noticed, the connection between your PowerShell session and the RDM instance is established automatically when you first send a command. However, if the RDM UI is closed, that connection is lost. Restarting your PowerShell session and sending the command again will re-establish this implicit connection with any open RDM instance.
At this time, the best practice is to keep both your PowerShell session and the RDM UI open and in sync while using commands like "Update-RDMUI." If you often find yourself needing to reconnect, restarting the PowerShell session seems to be the most reliable method.
If you think it would be useful to have a dedicated command to explicitly reconnect to a running RDM instance, I can submit a feature request to our development team. Please let us know if you would like this, and feel free to provide any additional details about your workflow.
Let me know if this helps or if you have any further questions.
Best regards,
Patrick Ouimet
Hi Patrick,
thank you for the answer. I think it would be good if the session connection tot he UI could be checked and reestablished if its gone, but a UI exists. Or, if the internal commands would check that the UI handle is invalid and then reestablish a session to a new UI process if one exists. This would be in line how the current operation mode is. As it is now, it is very confusion since there is no visible error, it just sometimes works and sometimes it does not.
I noticed it first when I was working on my app and had the powershell window open for several days and suddenly it stopped working, since I updated RDM and restarted it in the process. I uninstalled the RDM version and went back to the previous one, only to find it also did not work. I found a bunch of other posts about this (e.g. on reddit) where ppl had some solutions but all did not work for me (and for other ppl as well). That is when I decided to post here. What also was confusing was that "Get-RDMProcess" show the right process.
So I think making this behavior behave more unexpectedly would help with all of this. What also might help is to enable some more messages int the -verbose, so that it says when it has issues connecting to the UI.
Thanks a lot
Hello vendolis,
Thank you for the detailed follow-up.
Based on your testing, the entry update is being saved correctly, but the UI refresh notification does not reliably reach the currently running RDM window after RDM has been closed/reopened (or restarted during an update). In that situation, Update-RDMUI and the -Refresh switch can appear to do nothing, even though the data is updated (confirmed when you manually use Reload/F5).
Suggested next steps to try (without restarting your PowerShell session)
If you can share the following, it will help confirm whether the PowerShell module is still targeting an old/stale instance after RDM restarts
Regarding your request for improvements, what you described would be clearer from an automation perspective:
If you want, you can confirm that you would like this logged as a product improvement request (auto-reattach and better verbose/error messaging around UI refresh).
Documentation
Best regards,
Patrick Ouimet
Ok it took a little to get back to this. I created the following script, that assumes there is a "TestSystem" named RDMSession that has a tag that matches "*HyperVVM*". it also assumes Devolutions.PowerShell is installed. There are some "Read-host" entries to stop the script to check the result.
$rdmSessions = Get-RDMSession | Where-Object {$_.MetaInformation.Keywords -Like "*HyperVVM*"}
$rdmSession = $rdmSessions | where name -eq "TestSystem"
$rdmSession | select Name,URL
$ipAddress = "192.88.8.56"
$rdmSession.Url = $ipAddress
Set-RDMSession -Session $rdmSession -Refresh
Update-RDMUI
Get-RDMProcess
Get-RDMInstance
Read-Host -Prompt "System IP should be updated"
Restart-RDMProcess
Read-Host -Prompt "Wait for Process to fully been started."
Get-RDMProcess
Get-RDMInstance
$rdmSessions = Get-RDMSession | Where-Object {$_.MetaInformation.Keywords -Like "*HyperVVM*"}
$rdmSession = $rdmSessions | where name -eq "TestSystem"
$rdmSession | select Name,URL
$ipAddress = "192.88.8.67"
$rdmSession.Url = $ipAddress
Set-RDMSession -Session $rdmSession -Refresh
Update-RDMUI
Read-Host -Prompt "Check if IP was updated."
Start-RDMInstance
$rdmSessions = Get-RDMSession | Where-Object {$_.MetaInformation.Keywords -Like "*HyperVVM*"}
$rdmSession = $rdmSessions | where name -eq "TestSystem"
$rdmSession | select Name,URL
$ipAddress = "192.88.8.78"
$rdmSession.Url = $ipAddress
Set-RDMSession -Session $rdmSession -Refresh
Update-RDMUI
Get-RDMProcess
Get-RDMInstance
To replicate it I start RDM, then I start the Powershell session where I execute the script.
This is the transscript of my execution. The first time the UI updates, on the second and third try it does not. In between "Restart-RDMProcess" restarts the RDM.
**********************
PowerShell transcript start
Start time: 20260223144252
Username: TestUser
RunAs User: TestUser
Configuration Name:
Machine: MachineName (Microsoft Windows NT 10.0.26100.0)
Host Application: C:\Program Files\PowerShell\7\pwsh.dll
Process ID: 39540
PSVersion: 7.5.4
PSEdition: Core
GitCommitId: 7.5.4
OS: Microsoft Windows 10.0.26100
Platform: Win32NT
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1, 6.0, 7.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
WSManStackVersion: 3.0
**********************
Transcript started, output file is C:\Users\TestUser\Documents\RDMTest_Transscript.txt
PS C:\Code> $rdmSessions = Get-RDMSession | Where-Object {$_.MetaInformation.Keywords -Like "*HyperVVM*"}
PS C:\Code> $rdmSession = $rdmSessions | where name -eq "TestSystem"
PS C:\Code> $rdmSession | select Name,URL
Name Url
---- ---
TestSystem 192.88.8.78
PS C:\Code> $ipAddress = "192.88.8.56"
PS C:\Code> $rdmSession.Url = $ipAddress
PS C:\Code> Set-RDMSession -Session $rdmSession -Refresh
PS C:\Code> Update-RDMUI
PS C:\Code> Get-RDMProcess
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
303 502.10 490.42 21.47 46156 1 RemoteDesktopManager
PS C:\Code> Get-RDMInstance
ApplicationVersion OptionFilename
------------------ --------------
2025.3.3.0 C:\Users\TestUser\AppData\Local\Devolutions\RemoteDesktopManager\RemoteDesktopManager.cfg
PS C:\Code> Read-Host -Prompt "System IP should be updated"
PS C:\Code> Restart-RDMProcess
PS C:\Code> Read-Host -Prompt "Wait for Process to fully been started."
PS C:\Code> Get-RDMProcess
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
306 606.57 599.63 11.92 32980 1 RemoteDesktopManager
PS C:\Code> Get-RDMInstance
ApplicationVersion OptionFilename
------------------ --------------
2025.3.3.0 C:\Users\TestUser\AppData\Local\Devolutions\RemoteDesktopManager\RemoteDesktopManager.cfg
PS C:\Code> $rdmSessions = Get-RDMSession | Where-Object {$_.MetaInformation.Keywords -Like "*HyperVVM*"}
PS C:\Code> $rdmSession = $rdmSessions | where name -eq "TestSystem"
PS C:\Code> $rdmSession | select Name,URL
Name Url
---- ---
TestSystem 192.88.8.56
PS C:\Code> $ipAddress = "192.88.8.67"
PS C:\Code> $rdmSession.Url = $ipAddress
PS C:\Code> Set-RDMSession -Session $rdmSession -Refresh
PS C:\Code> Update-RDMUI
PS C:\Code> Read-Host -Prompt "Check if IP was updated."
PS C:\Code> Start-RDMInstance
PS C:\Code> $rdmSessions = Get-RDMSession | Where-Object {$_.MetaInformation.Keywords -Like "*HyperVVM*"}
PS C:\Code> $rdmSession = $rdmSessions | where name -eq "TestSystem"
PS C:\Code> $rdmSession | select Name,URL
Name Url
---- ---
TestSystem 192.88.8.67
PS C:\Code> $ipAddress = "192.88.8.78"
PS C:\Code> $rdmSession.Url = $ipAddress
PS C:\Code> Set-RDMSession -Session $rdmSession -Refresh
PS C:\Code> Update-RDMUI
PS C:\Code> Get-RDMProcess
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
311 690.37 776.84 14.23 32980 1 RemoteDesktopManager
PS C:\Code> Get-RDMInstance
ApplicationVersion OptionFilename
------------------ --------------
2025.3.3.0 C:\Users\TestUser\AppData\Local\Devolutions\RemoteDesktopManager\RemoteDesktopManager.cfg
PS C:\Code> Stop-Transcript
**********************
PowerShell transcript end
End time: 20260223144417
**********************
As for the DataSource, it is the local data source without any further configuration from the default install.
It would be great to have it as a Future Product improvement.
Thanks a lot