Ready to get started?

Download a free trial of the SQL Analysis Services Data Provider to get started:

 Download Now

Learn more:

SQL Server Analysis Services Icon SQL Analysis Services ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with SQL Analysis Services.

Automate SQL Analysis Services Integration Tasks from PowerShell



Are you in search of a quick and easy way to access SQL Analysis Services data from PowerShell? This article demonstrates how to utilize the SQL Analysis Services Cmdlets for tasks like connecting to SQL Analysis Services data, automating operations, downloading data, and more.

The CData ADO.NET Provider for SQL Analysis Services is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to SQL Analysis Services.

ADO.NET Provider

The ADO.NET Provider provides a SQL interface for SQL Analysis Services; this tutorial shows how to use the Provider to retrieve SQL Analysis Services data.

Once you have acquired the necessary connection properties, accessing SQL Analysis Services data in PowerShell can be enabled in three steps.

To connect, provide authentication and set the Url property to a valid SQL Server Analysis Services endpoint. You can connect to SQL Server Analysis Services instances hosted over HTTP with XMLA access. See the Microsoft documentation to configure HTTP access to SQL Server Analysis Services.

To secure connections and authenticate, set the corresponding connection properties, below. The data provider supports the major authentication schemes, including HTTP and Windows, as well as SSL/TLS.

  • HTTP Authentication

    Set AuthScheme to "Basic" or "Digest" and set User and Password. Specify other authentication values in CustomHeaders.

  • Windows (NTLM)

    Set the Windows User and Password and set AuthScheme to "NTLM".

  • Kerberos and Kerberos Delegation

    To authenticate with Kerberos, set AuthScheme to NEGOTIATE. To use Kerberos delegation, set AuthScheme to KERBEROSDELEGATION. If needed, provide the User, Password, and KerberosSPN. By default, the data provider attempts to communicate with the SPN at the specified Url.

  • SSL/TLS:

    By default, the data provider attempts to negotiate SSL/TLS by checking the server's certificate against the system's trusted certificate store. To specify another certificate, see the SSLServerCert property for the available formats.

You can then access any cube as a relational table: When you connect the data provider retrieves SSAS metadata and dynamically updates the table schemas. Instead of retrieving metadata every connection, you can set the CacheLocation property to automatically cache to a simple file-based store.

See the Getting Started section of the CData documentation, under Retrieving Analysis Services Data, to execute SQL-92 queries to the cubes.

  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for SQL Analysis Services\lib\System.Data.CData.SSAS.dll")
  2. Connect to SQL Analysis Services:

    $conn= New-Object System.Data.CData.SSAS.SSASConnection("User=myuseraccount;Password=mypassword;URL=http://localhost/OLAP/msmdpump.dll;") $conn.Open()
  3. Instantiate the SSASDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Fiscal_Year, Sales_Amount from Adventure_Works" $da= New-Object System.Data.CData.SSAS.SSASDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.fiscal_year $_.sales_amount }