Set-RDMCurrentWorkspace: Unexpected exception

Set-RDMCurrentWorkspace: Unexpected exception

avatar

we suddenly have an issue when starting Powershell scripts or just the integrated "Powershell (RDM CMDlet)" Tool

when the integrated Powershell opens this error appears:

Loading RDM CmdLet (Module)
Set-RDMCurrentWorkspace:
Line |
   6 |  Set-RDMCurrentDataSource -ID "735b67a3-1ac8-4080-8690-eafe6bf1ae96";
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unexpected exception
Set-RDMCurrentWorkspace:
Line |
   6 |  Set-RDMCurrentDataSource -ID "735b67a3-1ac8-4080-8690-eafe6bf1ae96";
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unexpected exception


Trying to manually set the Workspace has the same Issue (Real IDs swapped for random IDs):

PS C:\Users\a2.simmerstatter> get-rdmworkspace

ID           : 735b67a3-1ac8-4080-8690-eafe6e96bf1a
IsConnected  : False
IsDefault    : True
IsOffline    : False
Name         : WorkspaceName
RepositoryID : 00000000-0000-0000-0000-000000000000
Type         : RDMS

PS C:\Users\a2.simmerstatter> Set-RDMCurrentWorkspace -ID "735b67a3-1ac8-4080-8690-eafe6e96bf1a" -Verbose
VERBOSE: [Set-RDMCurrentWorkspace] Start
VERBOSE: Setting current workspace 'WorkspaceName' with repository '00000000-0000-0000-0000-000000000000'.
Set-RDMCurrentWorkspace: Unexpected exception

RDM: 2026.3.12.0
DVLS: 2026.3.7.0
Devolutions.Powershell: 2026.3.2

For now it apperas only cosmetically with no real effect on scripts, if this changes i wil update.

All Comments (5)

avatar

Hello Stefan,

Thank you for the detailed output, and good to know your scripts still run for now.

"Unexpected exception" does not say what went wrong. Devolutions Server sends that text back when a request fails on the server, and the module then shows it; the module also raises it when a server response happens to contain that phrase. Your -Verbose output stops right after "Setting current workspace", the step where the module makes that workspace current and loads its data from the server, so that is where we need to look.

Could you send us the following two items, both taken right after you run Set-RDMCurrentWorkspace -ID "<your workspace ID>" -Verbose again:

1. In the Devolutions Server web interface, Reports > Server logs (or ask your Devolutions Server administrator): the error entry logged at that time, as a CSV export or a screenshot showing its full message.

2. In the same PowerShell window, the output of this command, which shows where it failed:
$Error[0].Exception.ToString()

If there is no matching entry in Server logs, please tell us; that is useful too.

Also, did anything change shortly before this started, such as an update of Devolutions Server, RDM or the module, or a change in how this workspace signs in?

Best regards,

Michel

Michel Audi

avatar

Started New PWSH? YES
Import-Module Devolution.Powershell? NO
Get-RDMCurrentWorkspace: Fails
Sometimes it still shows the Details of the workspace and sometimes just the error, not clear whats the deciding factor here.

PS C:\Users\a2.simmerstatter>Get-RDMCurrentWorkspace: Unexpected exception

ID           : 735b67a3-1ac8-4080-8690-eafe6bf1ae96
IsConnected  : True
IsDefault    : True
IsOffline    : False
Name         : MACO
RepositoryID : 00000000-0000-0000-0000-000000000000
Type         : RDMS


Started New PWSH? YES via RDM "Powershell (RDM Cmdlet)"
Import-Module Devolution.Powershell? NO
Get-RDMCurrentWorkspace: Works

PS C:\Users\a2.simmerstatter> Get-RDMCurrentWorkspace

ID           : 735b67a3-1ac8-4080-8690-eafe6bf1ae96
IsConnected  : True
IsDefault    : True
IsOffline    : True
Name         : MACO
RepositoryID : 00000000-0000-0000-0000-000000000000
Type         : RDMS



Started New PWSH? YES
Import-Module Devolution.Powershell? NO but this preloads the Module anyway
Get-RDMCurrentWorkspace: Works

PS C:\Users\a2.simmerstatter> import-module devolutions.powershell
PS C:\Users\a2.simmerstatter> Get-RDMCurrentWorkspace

ID           : 735b67a3-1ac8-4080-8690-eafe6bf1ae96
IsConnected  : True
IsDefault    : True
IsOffline    : True
Name         : MACO
RepositoryID : 00000000-0000-0000-0000-000000000000
Type         : RDMS


Looks like it only fails when the Devolutions.Powershell module was not explicitely loaded before the command

Here is the full error message from $Error:

PS C:\Users\a2.simmerstatter> $Error.exception

Status         : UnknownError
Response       :
TargetSite     : T RunSynchronous[T](System.Threading.Tasks.Task`1[T])
Message        : Unexpected exception
Data           : {}
InnerException :
HelpLink       :
Source         : Devolutions.Server.ApiWrapper
HResult        : -2146233079
StackTrace     :    at Devolutions.Server.ApiWrapper.RDMSWebClient.RunSynchronous[T](Task`1 task)
                    at Devolutions.Server.ApiWrapper.RDMSWebClient.GetRoles()
                    at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.<GetRoles>b__308_0()
                    at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.RetryAction[T](ExecuteAct
                 ionDelegate`1 action, String label, Boolean failFastOnBackgroundThread)
                    at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.ExecuteAction[T](ExecuteA
                 ctionDelegate`1 action, ExecuteActionLogMode logMode, Boolean retryAction)
                    at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.ExecuteActionMultipleData
                 [T](ExecuteActionDelegate`1 action)
                    at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.GetRoles()
                    at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSSecuritySubDataSource.GetRoles()
                    at Devolutions.RemoteDesktopManager.Business.DataSources.ContextSubDataSource.RoleContext.GetAllRol
                 es(Boolean getAllRoleInformation, Boolean useRecentCache)
                    at Devolutions.RemoteDesktopManager.Business.DataSources.ContextSubDataSource.UserContext.GetCurren
                 tLoggedInUserNotCached(ConnectionEngine engine)
                    at Devolutions.RemoteDesktopManager.Business.DataSources.ContextSubDataSource.UserContext.get_UserE
                 ntity()
                    at
                 Devolutions.RemoteDesktopManager.Business.DataSources.ContextSubDataSource.get_IsUserVaultSupported()
                    at Devolutions.RemoteDesktopManager.Managers.ConnectionEngine.FindConnectionEx(Nullable`1
                 connectionId, String groupMain, Boolean searchOnlyCurrentEngine)
                    at Devolutions.RemoteDesktopManager.Managers.ConnectionEngine.FindConnectionEx(String
                 connectionId, Boolean searchOnlyCurrentEngine)
                    at Devolutions.RemoteDesktopManager.Managers.FavoriteManager.UpdatePayloads(ConnectionEngine
                 engine)
                    at Devolutions.RemoteDesktopManager.Managers.FavoriteManager.LoadFolders(ConnectionEngine engine)
                    at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnections(ConnectionEngine&
                 engine, Boolean refreshSubVaults)
                    at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnections(ConnectionEngine&
                 engine, Boolean refreshSubVaults)
                    at
                 Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnections(BaseConnectionDataSource
                 dataSource, ConnectionEngine& engine, Boolean refreshSubVaults)
                    at
                 Devolutions.RemoteDesktopManager.Managers.ConnectionManager.RefreshConnections(ConnectionEngine&
                 engine, Boolean refreshSubVaults)
                    at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.RefreshConnections(ConnectionEngine
                 engine, Boolean refreshSubVaults)
                    at Devolutions.RemoteDesktopManager.Managers.PowerShellConnectionManager.RefreshConnections(Connect
                 ionEngine engine, Boolean refreshSubVaults)
                    at Devolutions.RemoteDesktopManager.Managers.PowerShellConnectionManager.RefreshConnections(Connect
                 ionEngine engine)
                    at RemoteDesktopManager.PowerShellModule.BaseCommand.RefreshConnectionEngine(ConnectionEngine
                 engine)
                    at RemoteDesktopManager.PowerShellModule.BaseCommand.BeginProcessing()
                    at System.Management.Automation.CommandProcessorBase.DoBegin()

PS C:\Users\a2.simmerstatter> $Error.exception.tostring()
System.Net.WebException: Unexpected exception
   at Devolutions.Server.ApiWrapper.RDMSWebClient.RunSynchronous[T](Task`1 task)
   at Devolutions.Server.ApiWrapper.RDMSWebClient.GetRoles()
   at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.<GetRoles>b__308_0()
   at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.RetryAction[T](ExecuteActionDelegate`1 action, String label, Boolean failFastOnBackgroundThread)
   at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.ExecuteAction[T](ExecuteActionDelegate`1 action, ExecuteActionLogMode logMode, Boolean retryAction)
   at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.ExecuteActionMultipleData[T](ExecuteActionDelegate`1 action)
   at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSWebApiClient.GetRoles()
   at Devolutions.RemoteDesktopManager.Business.DataSources.RDMSSecuritySubDataSource.GetRoles()
   at Devolutions.RemoteDesktopManager.Business.DataSources.ContextSubDataSource.RoleContext.GetAllRoles(Boolean getAllRoleInformation, Boolean useRecentCache)
   at Devolutions.RemoteDesktopManager.Business.DataSources.ContextSubDataSource.UserContext.GetCurrentLoggedInUserNotCached(ConnectionEngine engine)
   at Devolutions.RemoteDesktopManager.Business.DataSources.ContextSubDataSource.UserContext.get_UserEntity()
   at Devolutions.RemoteDesktopManager.Business.DataSources.ContextSubDataSource.get_IsUserVaultSupported()
   at Devolutions.RemoteDesktopManager.Managers.ConnectionEngine.FindConnectionEx(Nullable`1 connectionId, String groupMain, Boolean searchOnlyCurrentEngine)
   at Devolutions.RemoteDesktopManager.Managers.ConnectionEngine.FindConnectionEx(String connectionId, Boolean searchOnlyCurrentEngine)
   at Devolutions.RemoteDesktopManager.Managers.FavoriteManager.UpdatePayloads(ConnectionEngine engine)
   at Devolutions.RemoteDesktopManager.Managers.FavoriteManager.LoadFolders(ConnectionEngine engine)
   at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnections(ConnectionEngine& engine, Boolean refreshSubVaults)
   at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnections(ConnectionEngine& engine, Boolean refreshSubVaults)
   at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnections(BaseConnectionDataSource dataSource, ConnectionEngine& engine, Boolean refreshSubVaults)
   at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.RefreshConnections(ConnectionEngine& engine, Boolean refreshSubVaults)
   at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.RefreshConnections(ConnectionEngine engine, Boolean refreshSubVaults)
   at Devolutions.RemoteDesktopManager.Managers.PowerShellConnectionManager.RefreshConnections(ConnectionEngine engine, Boolean refreshSubVaults)
   at Devolutions.RemoteDesktopManager.Managers.PowerShellConnectionManager.RefreshConnections(ConnectionEngine engine)
   at RemoteDesktopManager.PowerShellModule.BaseCommand.RefreshConnectionEngine(ConnectionEngine engine)
   at RemoteDesktopManager.PowerShellModule.BaseCommand.BeginProcessing()
   at System.Management.Automation.CommandProcessorBase.DoBegin()
PS C:\Users\a2.simmerstatter>



Serverlogs shows this message 4-5 times:

AccessDeniedException - Exception of type 'Devolutions.Server.V2.Domain.Exceptions.AccessDeniedException' was thrown.at Devolutions.Server.V2.Application.Common.GuardClause.IGuardExtensions.HasPermission[G](G guard, Func`1 predicate)at Devolutions.Server.Controllers.ControllerGuard.HasAdministrativePermission(AdministrativePermission permission)at Devolutions.Server.Controllers.APIControllers.V2.SecurityController.GetRoles()at lambda_method631(Closure, Object, Object[])at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()--- End of stack trace from previous location ---at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()--- End of stack trace from previous location ---at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
avatar

Hello Stefan,

Thank you for the full error output, and for testing the different ways of starting PowerShell.

Your trace shows that the call that fails is the one where the module reads the user groups from Devolutions Server (GetRoles). The trace comes from the module, so it does not show why the request failed on the server, but it matches an issue we already know of: since Devolutions Server 2026.3.4.0, when this request comes from the PowerShell module, the server accepts it only from an account that holds the administrative permission to view user groups, and an account without it gets "Unexpected exception". Our developers are already looking into this issue.

The Server logs entry will confirm whether this is what happens on your server, so it is still useful when your administrator is back. If it is this issue, the entry reads AccessDeniedException with SecurityController.GetRoles. If it shows something else, or there is no matching entry, please tell us what you see. It would also help to know whether Devolutions Server was updated shortly before the error started, and from which version.

About Import-Module: in your two runs that worked, the output shows IsOffline : True, and in the run that failed, IsOffline : False. When the workspace is offline, the module does not make this call to the server, which matches what you saw.

As your scripts keep working, there is nothing to change on your side for now.

Best regards,

Michel

Michel Audi

avatar

hi Michel,

i added the server logs to the previous comment.
About the IsOffline, thanks for the pointer, the interesting part is that i never switched to "offline" mode.
and RDM, which was open in the background while testing, was also not in offline mode.

avatar

Hello Stefan,

Thank you for adding the Server logs entry. It shows AccessDeniedException in SecurityController.GetRoles, so this is the issue described in my last reply: Devolutions Server refuses the PowerShell module's request to read the user groups because the account it signs in with does not hold the administrative permission to view user groups.

About IsOffline: it can change without offline mode being selected in RDM. The module makes this same request to read the user groups at more than one step while it loads the workspace. When it is refused at an earlier step, the module handles it like a lost connection and can switch the workspace to offline mode in that PowerShell session, either automatically or after a "Go offline" prompt, depending on the workspace settings. When it is refused at a later step, as in your run that failed, the error is shown instead.

You do not need to send anything else, including the Devolutions Server update details I asked about. Our developers have prepared a fix, planned for an upcoming Devolutions Server release. As your scripts keep working, there is nothing to change on your side until then.

Best regards,

Michel

Michel Audi