Setting DataSource for PowerShell Module

Resolved

Setting DataSource for PowerShell Module

avatar

Hi,

We're trying to make a script to automatically install the powershell module and connect to our SQL database (this is for an automatic integration with AutoTask we are developing for internal use). When we connect to our database everything works fine until we close the powershell session. When we open a new powershell session after the first session was closed, the datasource used by the devolutions.powershell module is reset to the one it was using before our script ran. Here you find the relevant piece of code from our script:

$password = 'XXXXXXXXXXXXXXXXXXX' | ConvertTo-SecureString -AsplainText -Force
$DS = New-RDMDataSource -SQLServer -Database "RDM" -Server "<ip-addres>" -Name "SQL data source AWS" -username <username> -password $password -SetDataSource
Set-RDMDataSource $DS
$DS = Get-RDMDataSource -Name "SQL data source AWS"
Set-RDMCurrentDatasource $DS

We would want it to keep using the "SQL data source AWS" datasource we set with our script in every powershell session we open.

Thanks in advance!
Ruben

All Comments (2)

avatar

Sorry I see I posted in the wrong forum. I asked my question again in the Powershell modules support form so this one can be ignored (I can't find a way to delete the question).

https://forum.devolutions.net/topics/39486/setting-datasource-for-powershell-module#176314

Greetings
Ruben

avatar

Hello,

No worries, we can keep it here with the link you provided so our community can follow the thread.

For your information, we have the ability to move a thread in the appropriate section if required. Next time, no need to post again your question in the related section and just ask us to move it.

Best regards,

Érica Poirier