New-RDMDataSource does not create new datasource anymore

New-RDMDataSource does not create new datasource anymore

avatar

Hi all
in mij W10 deployment scripts I had a script run under the user's context to add RDM datasources to the user profile, during 1st logon in the new workstation.
(Don't know if that is still needed, in the past I tried to create these datasource connections for 'all users' within the system profile but that never worked)

But now since several RDM releases the powershell script runs successfully, If I run Get-RDMDatasource, the datasource is visible, BUT it is NOT visible in the GUI, and thus not working.
I even found out that if I add a second datasource via PowerShell it shows 2 in Powershell, 1 in the GUI (one I had to create manually in the GUI because the PowerShell version didn't work). if I remove the 1 from the GUI, it shows none (except the default 'local' datasource) in the GUI, and still 2 in PowerShell.

The commands used to create a datasource are little but longer than below, but essentially:

$SQLServer = 'myDbServer.mycompany.com'
$DatabaseName='myDBName'
$DataSourcename='myDBName'

$DS = New-RDMDataSource -SQLServer -Database $DatabaseName -IntegratedSecurity -Server $SqlServer -Name $DataSourcename -SetDataSource

Set-RDMDatasourceProperty -DataSource $DS -Property AutoGoOffline        -Value $True
Set-RDMDatasourceProperty -DataSource $DS -Property AllowOfflineMode     -Value $True
Set-RDMDatasourceProperty -DataSource $DS -Property AllowOfflineEdit     -Value $True
Set-RDMDatasourceProperty -DataSource $DS -Property PromptForOfflineMode -Value $False
Set-RDMDatasourceProperty -DataSource $DS -Property PingOnlineMethod     -Value "Ping"
Set-RDMDatasourceProperty -DataSource $DS -Property IsDefault            -Value $True

Set-RDMDataSource -DataSource $DS

the CMDLets I use are from:

PS C:\> Get-Command New-RDMDataSource | ft -AutoSize

CommandType Name              Version    Source
----------- ----              -------    ------
Cmdlet      New-RDMDataSource 2022.1.3.4 RemoteDesktopManager


Note that the code is created in the time that the PowerShell cmdlets were still included in the RDM installation itself, It was working initially. I believe the module was then called RemoteDesktopManager.PowerShellModule.
I have the impression this problem started from the time the PS cmdlets were not included anymore in the MSI, but had to be downloaded separately from PSGallery.

PS. I now search in PSGallery and see there is a NEWER version 2022.2.0.0 on there, downloaded that one, loaded it and retried, but it has the same behaviour

All Comments (6)

avatar

Hello,

Thank you for reporting this behaviour.

Could you please verify that the location of the RDM configuration matches the location of the configuration file using by the PowerShell module?

With PowerShell, you will get the information with Get-RDMInstance cmdlet.

forum image

In RDM, you will find the information in File - Options - Advanced under Information section.

forum image

If they are not using the same configuration path, you can override the PowerShell configuration path using the cmdlets as explained in the Use an override configuration (portable) section of this article.
ttps://kb.devolutions.net/kb_rdmpowershellcore.html#use-an-override-configuration-(portable)

Let me know if that helps.

Best regards,

Érica Poirier

avatar

Hi Erica thanks for your reply
I checked both settings and they are equal...

forum image

forum image

i'll also (later) check if this .cfg file changes or check it's contents after running the PS commands to add the datasource..

avatar

Hi,

I would like to clarify something with you.
What version of RDM are you currently running?
In your latest screenshot, PS module 2022.1.3.4 is loaded even tho you are in the 2022.2 module's folder.
If you meant to run 2022.2 without installing it, you can do the following.

In a new PS instance, change the directory to C:\Temp\PSModules\RemoteDesktopManager\2022.2.0.0
Execute the following command: Import-Module ./RemoteDesktopManager.psd1

You can now run the Get-RDMInstance command.

Jonathan Lafontaine

avatar

Hi Jonathan.

I'm running RDM version 2022.1.27.0

the initial tests were done with PS module 2022.1.3.4. (however I didn't run Get-RDMInstance in that version)
When I downloaded the 2022.2.0.0 PS module, and used it, it asked me to upgrade the database, which I did (output below).
however even when I force to load the 2022.1.3.4 version of the PS module it still uses the 2022.2.0.0 version.

forum image

after killing this powershell session, and removing the 2022.2.0.0 module from the system I was able to re-run the command with the 2022.1.3.4 version of PowerShell. Output is similare to the 2022.2.0.0 PS output and to the version in the tool itself
forum image
recap, info from RDM options - Advanced:
forum image

avatar

Does Update-RDMUI help in this?

I had added a new test-datasource in the GUI.
both the GUI and the ps command showed 3 Datasources.
I removed 1 datasource from the GUI, the PS command still showed 3

then I ran Update-RDMUI and the PowerShell showed 2 datasources.
However, if I then ran our script again to add a datasource, the PowerShell shows 3. but even after repeated Update-RDMUI the GUi still shows 2.

Regards, Ben van Zanten

avatar

Oh, I might have an idea of what is happening.

Update-RDMUI does two things.

  1. It refreshes the module's internal data structure. (Same as the refresh button in RDM). It can be useful when adding or modifying entries in batch to delay the refresh to improve performance instead of refreshing after each modification.
  2. It will send a refresh command to a running RDM instance.


As you have noticed, refreshing the module data structure will reload the data source list. However, RDM doesn't.
When adding data sources using the PowerShell module, it is recommanded to close RDM. If RDM runs, it won't see the changes made by the module and overwrite them when closing.

You can use Stop-RDMProcess and Start-RDMProcess stop and restart RDM from your script.

Let me know if this helps

Regards

Jonathan Lafontaine