Ready to get started?

Download a free trial of the SAP HANA XS Advanced Data Provider to get started:

 Download Now

Learn more:

SAP HANA XS Advanced Icon SAP HANA XS Advanced ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with SAP HANA XS Advanced.

Automate SAP HANA XS Advanced Integration Tasks from PowerShell

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

The CData Cmdlets for SAP HANA XS Advanced are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to SAP HANA XS Advanced.

PowerShell Cmdlets or ADO.NET Provider?

The Cmdlets are not only a PowerShell interface to SAP HANA XS Advanced, but also an SQL interface; this tutorial shows how to use both to retrieve SAP HANA XS Advanced data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for SAP HANA XS Advanced. To access SAP HANA XS Advanced data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for SAP HANA XS Advanced.

Once you have acquired the necessary connection properties, accessing SAP HANA XS Advanced data in PowerShell can be enabled in three steps.

SAP HANA XSA uses the OAuth authentication standard. Before connecting, it is necessary to establish an SAP HANA XSA OData Service. See the OAuth section in the Help documentation for a guide.


  1. Install the module:

    Install-Module SAPHanaXSACmdlets
  2. Connect:

    $saphanaxsa = Connect-SAPHanaXSA -OAuthClientID "$OAuthClientID" -OAuthClientSecret "$OAuthClientSecret" -URL "$URL" -CallbackURL "$CallbackURL"
  3. Search for and retrieve data:

    $ = "" $ = Select-SAPHanaXSA -Connection $saphanaxsa -Table "" -Where " = `'$`'" $

    You can also use the Invoke-SAPHanaXSA cmdlet to execute SQL commands:

    $ = Invoke-SAPHanaXSA -Connection $saphanaxsa -Query 'SELECT * FROM WHERE = @' -Params @{'@'=''}


  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for SAP HANA XS Advanced\lib\System.Data.CData.SAPHanaXSA.dll")
  2. Connect to SAP HANA XS Advanced:

    $conn= New-Object System.Data.CData.SAPHanaXSA.SAPHanaXSAConnection("OAuthClientID=my-ouath-client-id;OAuthClientSecret=my-oauth-client-secret;URL=https://hxehost:51027/euro.xsodata;CallbackURL=http://localhost:33333;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the SAPHanaXSADataAdapter, execute an SQL query, and output the results:

    $sql="SELECT , from " $da= New-Object System.Data.CData.SAPHanaXSA.SAPHanaXSADataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_. $_. }