Hi all,
I'm using a PowerShell script to populate our initial data source connection.
the script main part is :
Import-Module RemoteDesktopManager.PowerShellModule
New-RDMDataSource -SQLServer -Database ###### -IntegratedSecurity -Server ###### -Name ###### -SetDataSource
The names have been altered here, for privacy reasons.
What I need to do is the following 2 tasks:
The documentation on New-RDMDataSource or Set-RDMDatasource is hard to find...
( https://help.remotedesktopmanager.com/set-rdmdatasource.html link on post : https://forum.devolutions.net/topics/26766/create-a-new-data-source-with-powershell doesn't work anymore).
I did find the properties should be in a config file, which I also found:
C:\Users\<my user name>\AppData\Local\Devolutions\RemoteDesktopManager\RemoteDesktopManager.cfg
however, the datasource info in there is encrypted: <EncryptedDataSources> <string> --encrypted blob </string> </EncryptedDataSources>
Then , i was able to READ the property,
PS C:\> $DS = (Get-RDMDataSource)[1] # My first datasource is a local data source. this one is the SQL one
PS C:\> Get-RDMDatasourceProperty -DataSource $DS -Property "Auto go offline"
False
but NOT : SET it.
PS C:\> Set-RDMDatasourceProperty -DataSource $DS -Property "Auto go offline" -Value True
WARNING: Path or property not found. Value not set.
PS C:\> Set-RDMDatasourceProperty -DataSource $DS -Property "Auto go offline" -Value $True
WARNING: Path or property not found. Value not set.
PS C:\> Set-RDMDatasourceProperty -DataSource $DS -Property "Auto go offline" -Value "$True"
WARNING: Path or property not found. Value not set.
PS C:\> Set-RDMDatasourceProperty -DataSource $DS -Property "Auto go offline" -Value "True"
WARNING: Path or property not found. Value not set.
and the same q goes for the license. Is there a PowerShell way we can set the license to use from the datasource ?
Regards, and Thanks In Advance, Ben
Hello,
To enable the Auto go offline option using PowerShell, here is a sample command.
Set-RDMDataSourceProperty -DataSource $DS -Property AutoGoOffline -Value $true
About the license, what RDM version are you using?
If you re using RDM 2020.1.x, have you assigned the licenses in Administration - Licenses to your users?
Best regards,
Érica Poirier
Hi Erica
Thanks for your reply ; that worked !
Found out, I also needed to close this all off with a : Set-RDMDataSource -DataSource $DS, in order to commit changes.
So my script would look something like:
Import-Module RemoteDesktopManager.PowerShellModule $DS = New-RDMDataSource -SQLServer -Database ###### -IntegratedSecurity -Server ###### -Name MySQLDS -SetDataSource Set-RDMDatasourceProperty -DataSource $DS -Property AutoGoOffline -Value $True Set-RDMDataSource -DataSource $DS
Regarding licenses: we're running 2019.2.24.0 and all users have indeed been granted a license in the user database.
Regards, Ben
Hi Erica,
I have to come back on this thread. It is NOT working as expected, yet.
I create my DataSources with the script above, when I look in the GUI : File - DataSources - <select DS> - Settings Tab I see the 'auto go offline' checked.
So initially it seemed to be OK.
However:
Another big issue for me is the documentation on properties for datasources in the PowerShell cmdlets:
Set-RDMDatasourceProperty -DataSource $DS -Property AutoGoOffline -Value $True
How do I know which properties I can set? AutoGoOffline and others... I know about AutoGoOffline because you gave it to us...
Please give us the other properties as well, or better: document them somewhere beneath : https://help.remotedesktopmanager.com/powershell_cmdlets.html
When I run Get-RDMDatasourceProperty -Datasource $DS , I have to specify the property name but cant find the possible names. Tried with * but that doesn't work.
I already looked in my local configuration file: C:\Users\<MyUserName>\AppData\Local\Devolutions\RemoteDesktopManager\RemoteDesktopManager.cfg
There my users datasources seem to be configured, however they are encrypted thus I cannot read the configured properties from there, pity..
Can we have a documented list of possible Properties, or some other way to read them from my config file (set via gui and reverse engineer via this XML)
Regards, Ben van Zanten
Hello,
To get all properties of a data source object, export it in a .rdd file. This .rdd file contains the XML code of the data source.
https://help.remotedesktopmanager.com/datasource_importexport.html
And sorry about the issue with the AutoGoOffline mode property. The following two properties were missing in my previous post, AllowOfflineMode and AllowOfflineEdit. So here what it should look like to get that data source to automatically switch to Offline mode if no connection to the database is available.
$ds = New-RDMDataSource -SQLServer -Server YourSQLServer -Database YourSQLDatabase -Name YourDataSourceName -IntegratedSecurity 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-RDMDataSource $ds
Best regards,
Érica Poirier