Add SQL Datasource via PowerShell not working in 14.1.1.0

Add SQL Datasource via PowerShell not working in 14.1.1.0

avatar

I'm currently migrating our SQL Server where the RDM databases reside.
In the past we manually setup the datasources with .rdd files on the users computers.

To avoid manual reconfiguration of all clients i've created a powershell script to look for the used server in all configured datasources
and if there is one present with the old server this connection is deleted and recreated with the new server.

This works fine on my Workstation with RDM Version 2020.1.20.0 - but on my testdevice which has the same version as all other clients (14.1.1.0) it's not working.

i tried to manually add a datasource via PS but without success -i'll get the response below but when i run Get-RDMDatasource it's still not present.

New-RDMDataSource -SQLServer -Database DATABASE -IntegratedSecurity -server Server -Name PSTest -setdatasource

forum image

Also deleting a manually added datasource via PS is not working - thats the reason why me script is not working - Am i missing something here?

Here the script :

Import-Module RemoteDesktopManager.PowerShellModule

$SQLServer='NewSQLServersHostname'
$OldSQLServer='OldSQLServersHostname'
$AutoGoOffline='True'
$PromptOfflineMode='False'
$Timeout='30'
$CommandTimeout='60'
$CurrentDatasources = get-RDMDatasource


foreach ($Datasource in $CurrentDatasources) {
    $CurrentSQLServer = Get-RDMDatasourceProperty -DataSource $Datasource -Property Server
    $Database = Get-RDMDatasourceProperty -DataSource $Datasource -Property Database
    if($CurrentSQLServer -eq $OldSQLServer){
        Remove-RDMDataSource -DataSource $DataSource
        $DS = New-RDMDataSource -SQLServer -Database $Database -IntegratedSecurity -Server $SQLServer -Name $Database -SetDataSource
        Set-RDMDatasourceProperty -DataSource $DS -Property AutoGoOffline -Value $AutoGoOffline
        Set-RDMDatasourceProperty -DataSource $DS -Property CommandTimeout -Value $CommandTimeout
        Set-RDMDatasourceProperty -DataSource $DS -Property Timeout -Value $Timeout
        Set-RDMDatasourceProperty -DataSource $DS -Property PromptForOfflineMode -Value $PromptOfflineMode
        Set-RDMDataSource -DataSource $DS
    }
}


All Comments (3)

avatar

Hello,

I get the exact same behaviour on RDM 14.1.3. As we do not fix old RDM version, we cannot help you on that matter with the PowerShell script.

As a workaround, you can instead create a Custom Installer package of RDM version 14.1.1 that will contain the SQL data source with the proper parameters. You can even create that package from your RDM 2020.1.20. Please see this online documentation about Custom Installer Service.

Best regards,

Érica Poirier

avatar

Ok thanks for your feedback, i think we will solve it by upgrading to the latest version

avatar

Hello,

Thank you for your feedback and glad that upgrading to the latest version has solved the issue.

Best regards,

Érica Poirier