Portable version gives "Import-Module : The specified module 'RemoteDesktopManager' was not loaded because no valid module file was found in any module directory"

Portable version gives "Import-Module : The specified module 'RemoteDesktopManager' was not loaded because no valid module file was found in any module directory"

avatar

We are using the portable version of RDM 2021.2.20.0. This version is placed on a shared folder of our fileserver. Config is stored in the user profile of each user. When I launch the PowerShell (RDM CmdLet) I get the error that the module could not be imported.



Have I missed something during "installation" of the Portable version of RDM?

ddrxxc7Ce8.png

All Comments (16)

avatar

Hello Jasper,

Since version 2021.2 of RDM, the RDM PowerShell module is no longer included in the installation of RDM, it needs to be installed from PowerShellGallery. You can install it with Install-Module -Name RemoteDesktopManager and you can find more details here: https://kb.devolutions.net/kb_rdmpowershellcore.html

Best regards,

Richard Boisvert

avatar

Hi Richard,

I followed the KB article. I also followed the Get-RDMPowerShellOverride part. When I launch the PowerShell (RDM CmdLet) from the ribbon the errors are gone. But now there is the warning "Data source not found" instead.

I'm only using one data source which is on a MS SQL Server. This is what I see now:

Resize PowerShell buffer and window size
Loading RDM CmdLet (Module)
WARNING: Data source not found                                                                                                                                                                  PS C:\> Get-RDMPowerShellOverride                                                                                                                                                                                                                                                                                                                                                               OptionFilePath                                                                                    RemoteDesktopManagerExecutablePath                                                            --------------                                                                                    ----------------------------------
C:\Users\jkimmel\AppData\Roaming\Devolutions\RemoteDesktopManager\config\RemoteDesktopManager.cfg \\xxxxxx.xxx\dfs\Portable Apps\Remote Desktop Manager\RemoteDesktopManager64.exe


PS C:\> $Ret=Get-RDMPowerShellOverride
PS C:\> $ret.OptionFilePath
C:\Users\jkimmel\AppData\Roaming\Devolutions\RemoteDesktopManager\config\RemoteDesktopManager.cfg
PS C:\> test-path $ret.OptionFilePath
True
PS C:\> Get-RDMDataSource


ID          : 95472043-6413-429a-ae7a-05141e9334b5
IsConnected : True
IsOffline   : False
Name        : Local Data Source
Type        : SQLite
avatar

Hello Jasper,

As long as the path to the CFG is good, you can simply do the following. Note that this way, you do not have to have RDM installed to be able to access it, and you only need to run it once:

#for integrated security
New-RDMDataSource -Database <string> -Name <string> -Server <string> -SQLServer -IntegratedSecurity -SetDatasource
#using a SQL account
New-RDMDataSource -Database <string> -Name <string> -Password <securestring> -Server <string> -SQLServer -Username <string> -SetDatasource


Then, connect using the following

$ds = Get-RDMDataSource "datasource-name"
Set-RDMCurrentDataSource $ds
$ds


Result:

ID          : 9775d39f-e3e6-483b-a9f2-c8e16617c874
IsConnected : True
IsOffline   : False
Name        : datasource-name
Type        : SQLServer


You can then do a Get-RDMSession, etc.

Best regards,

Richard Boisvert

avatar

Hi Rchard,

Thanks for your reply. I followed your instructions and that worked. Every time I close and reopen RDM Portable the issue described in my first message returns and I need to follow your instructions again.

Is this default behaviour?

avatar

Hello Jasper,

I am glad it works when creating a new data source.

It seems the issue is caused by using the portable version. If you open the portable version, do you see the SQL data source? If not, can you create it there and see if it is available using the RDM PS module.

Best regards,

Richard Boisvert

avatar

Hi Richard,

The portable version is working fine and the SQL data source is available. Also when I use Powershell code as an event of an entry the $RDM variable is returning all info of that certain entry.

It is only necessary to go through the New-RDMDataSource process when I launch the PowerShell (RDM CmdLet) or launch Powershell.exe itself.
It is fine by me if this is default behavior.

avatar

Hello Jasper,

Could you run Get-RDMInstance and see if it points to the correct .cfg file? It should be the same path as RDM, if you go to File > Options - Advanced
forum image

If it matches, can you run Get-RDMDataSource in PS and see if the SQL data source is listed?

Best regards,

Richard Boisvert

avatar

Hi Richard,

There is a slight difference but I'm sure that this is not the issue. Your screenshot shows exactly the same difference
forum image
forum image

avatar

Hello Jasper,

The Get-RDMSession is not returning anything since I assume your Local Data Source is empty.

Could you run this command Get-RDMRegistrationInfo and let me know if the serial is properly displayed?
If the information is incomplete or missing, it will not be able to establish the connection to the SQL data source.

You can fix it with those commands:

$license = Get-RDMRegistrationInfo
$license.Name = "name"
$license.Email = "email"
$license.Serial = "serial"
Set-RDMRegistrationInfo $license


You can then try to reconnect to your data source in PowerShell.

Best regards,

Richard Boisvert

avatar

Hi Richard,

Below two screens in one shot which says it all.

forum image

Reconnecting every time I launch this, is not a hassle. It would be if Powershell events wouldn't work either.

avatar

Hello Jasper,

It is as if the PowerShell did not have enough rights to read/write to your local AppData, and the registration was lost.

Do you have the same behavior with a non-portable version?

Best regards,

Richard Boisvert

avatar

Hi Richard,

I did some further analysis and eventually the non-portable version had the same behavior. This is what I analyzed.

I installed the non-portable version and pointed to the same SQL datasource as the portable version. The non-portable version didn't have the same behavior at this point.

I noticed you mentioned local AppData in your previous post. This triggered my because there is a difference between the two versions though.
Our portable version has an override.cfg file which redirects RDM to the folder %AppData%\Devolutions\RemoteDesktopManager\config while the non-portable version is still pointing to its default folder %LocalAppData%\Devolutions\RemoteDesktopManager\config.
I also noticed that in the parent user folder of the non-portable version (%LocalAppData%\Devolutions\RemoteDesktopManager) a lot of other files and folders are present, including the config folder. Those are not present in the overridden config folder of the portable version.

So I decided to create an override.cfg file for the non-portable version which redirects RDM to a new folder %LocalAppData%\Devolutions\Test\RemoteDesktopManager\config. When there is an override in place the non-portable version is having the same behavior.

In reproduced both situations while running PSTools Process Monitor. I was not able to find any cause yet. Maybe you can. I will send you a DM with a link to download the results and an export of the used configuration of both situations. Hopefully all this info supports you to complete the root cause analysis.

Regards,

Jasper

avatar

Hi Jasper,

I was wondering what version of the PowerShell module you were using.
You can easily find out with the following command

Get-RDMInstance


Regards

Jonathan Lafontaine

avatar

Hi,

I'm on 2021.2.0.29 while RDM itself is 2021.2.23.0.

Regards.

Jasper

avatar

Any progress @Jonathan

Hi Jasper,

I was wondering what version of the PowerShell module you were using.
You can easily find out with the following command
Get-RDMInstance
Regards
avatar

Hi Jesper,

I've sent you a private message a couple days ago, have you received it?

Regards

Jonathan Lafontaine