Forum Discussion

vk_pbi's avatar
vk_pbi
Icon for Resolver II rankResolver II
3 years ago

PowerShell Script to export Database Connection strings in XMLA

Hi there,

I am working on a automation project, where i have a requirement to update the connection strings and credentials via powershell.

The process flow would likely to be 

>Connect SQL Server Analysis Services

>Select an Database

>Export the connection details into a xmla file.

 

Currently we are doing it manually via SSMS

> Opening SSMS --> Connect to SQL Server Analysis Services

>Select required Database

>Expand Connections folder --> Select and Right click a connection

>Right Click --> Script Connection as --> CREATE OR REPLACE To --> New Query Editor Window

 

This will generate a xmla scirpt of that connection. I want to achieve this process via powershell.

 

Thanks

10 Replies

  • How is this question related to Power BI?  I assume you are aware of the Power BI REST API?

    • vk_pbi's avatar
      vk_pbi
      Icon for Resolver II rankResolver II

      Its not directly related.. Yes I am aware of Power BI Rest Api, but it doesn't work with Onprem report server.

      So I need to achieve this without using webservice

      • R1k91's avatar
        R1k91
        Icon for Super User rankSuper User

        If powershell is not a requirement maybe you could think to use Tabular Editor and a combiantion of Advanced Scripting and Command Line interface.

        I've not tested with your usecase but I did something similar in the past: https://medium.com/p/49e8f4a236f9