Powershell - Invoke-RDMParentSession throws "Access Denied"

Powershell - Invoke-RDMParentSession throws "Access Denied"

avatar

Hello all,

I'm trying to add a new subconnection to an existing session.
However, I keep getting "Access Denied", although I'm able to do this through the GUI (I have RW access to the datasource).
Even worse, the return code is "True" although nothing happens.

Minimal example:



PS C:\Windows\system32> Import-Module "${env:ProgramFiles(x86)}\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShellModule.psd1"
PS C:\Windows\system32> $s = Get-RDMSession -Name server01
PS C:\Windows\system32> $new = New-RDMSession -Name Test -Type WebBrowser
PS C:\Windows\system32> $new.WebBrowserUrl = "https://example.com/"
PS C:\Windows\system32> Invoke-RDMParentSession -ParentSession $s -Session $new
WARNING: Access denied
PS C:\Windows\system32> echo $?
True

All Comments (5)

avatar

Hello,

Before being able to add a session as a subconnection, you need first to save it in the data source using the Set-RDMSession cmdlet. Then, you will be able to add it as a subconnection to another parent session. Your code should look like this:

Import-Module "${env:ProgramFiles(x86)}\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShellModule.psd1"
$s = Get-RDMSession -Name server01
$new = New-RDMSession -Name Test -Type WebBrowser
$new.WebBrowserUrl = "https://example.com/"
Set-RDMSession $new - Refresh
Invoke-RDMParentSession -ParentSession $s -Session $new

Best regards,

Érica Poirier

avatar

Hello,

I've tried your suggestion but I'm still getting "WARNING: Access Denied".
Set-RDMSession works, it creates a new session. How can this be a permission problem (as indicated by the warning) if I can do it through GUI?

avatar

Kinda funny, I just tried the opposite: create a subconnection manually and run "Invoke-RDMUnparentSession".
It also throws "WARNING: Access denied" but it works.


PS C:\Users\> Invoke-RDMUnparentSession $s.SubConnections -Refresh
WARNING: Access denied
Do you really want to un-parent the selected entries?
[Y] Yes [N] No (default 'N'):
y
PS C:\Users\>

avatar

I managed to solve this problem on my own.
There is no need to run Set-RDMSession first, it is possible without it.

The problem was that I needed Admin rights on the datasource to be able to do it.
This also explains why the "Parent" option never showed up in my right-click menu.

You might want to inform your devs that Invoke-RDMParentSession is only possible with admin, but Invoke-UnparentRDMSession works without it (although it returns the same warning).

avatar


Hello,

I should have asked if you were connected with an administrator account when managing subconnections in RDM or with PowerShell. It's by design that only an administrator can parents or unparents subconnections. It's strange that you were able to do it in RDM even without administrator privileges.


Best regards,

Érica Poirier