Ready to get started?

Download a free trial of the Presto Data Provider to get started:

 Download Now

Learn more:

Presto Icon Presto ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Presto.

Automate Presto Integration Tasks from PowerShell

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

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

PowerShell Cmdlets or ADO.NET Provider?

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

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

Set the Server and Port connection properties to connect, in addition to any authentication properties that may be required.

To enable TLS/SSL, set UseSSL to true.

Authenticating with LDAP

In order to authenticate with LDAP, set the following connection properties:

  • AuthScheme: Set this to LDAP.
  • User: The username being authenticated with in LDAP.
  • Password: The password associated with the User you are authenticating against LDAP with.

Authenticating with Kerberos

In order to authenticate with KERBEROS, set the following connection properties:

  • AuthScheme: Set this to KERBEROS.
  • KerberosKDC: The Kerberos Key Distribution Center (KDC) service used to authenticate the user.
  • KerberosRealm: The Kerberos Realm used to authenticate the user with.
  • KerberosSPN: The Service Principal Name for the Kerberos Domain Controller.
  • KerberosKeytabFile: The Keytab file containing your pairs of Kerberos principals and encrypted keys.
  • User: The user who is authenticating to Kerberos.
  • Password: The password used to authenticate to Kerberos.


  1. Install the module:

    Install-Module PrestoCmdlets
  2. Connect:

    $presto = Connect-Presto -Server "$Server" -Port "$Port"
  3. Search for and retrieve data:

    $id = "123456789" $customer = Select-Presto -Connection $presto -Table "Customer" -Where "Id = `'$Id`'" $customer

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

    $customer = Invoke-Presto -Connection $presto -Query 'SELECT * FROM Customer WHERE Id = @Id' -Params @{'@Id'='123456789'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Presto.PrestoConnection("Server=;Port=8080;") $conn.Open()
  3. Instantiate the PrestoDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT FirstName, LastName from Customer" $da= New-Object System.Data.CData.Presto.PrestoDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.firstname $_.lastname }

Update Presto Data


Update-Presto -Connection $Presto -Columns @('FirstName','LastName') -Values @('MyFirstName', 'MyLastName') -Table Customer -Id "MyId"


$cmd = New-Object System.Data.CData.Presto.PrestoCommand("UPDATE Customer SET Id='123456789' WHERE Id = @myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Presto.PrestoParameter("@myId","10456255-0015501366"))) $cmd.ExecuteNonQuery()

Insert Presto Data


Add-Presto -Connection $Presto -Table Customer -Columns @("FirstName", "LastName") -Values @("MyFirstName", "MyLastName")


$cmd = New-Object System.Data.CData.Presto.PrestoCommand("INSERT INTO Customer (Id) VALUES (@myId)", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Presto.PrestoParameter("@myId","123456789"))) $cmd.ExecuteNonQuery()

Delete Presto Data


Remove-Presto -Connection $Presto -Table "Customer" -Id "MyId"


$cmd = New-Object System.Data.CData.Presto.PrestoCommand("DELETE FROM Customer WHERE Id=@myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Presto.PrestoParameter("@myId","001d000000YBRseAAH"))) $cmd.ExecuteNonQuery()