Ready to get started?

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

 Download Now

Learn more:

Streak Icon Streak ADO.NET Provider

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

Automate Streak Integration Tasks from PowerShell



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

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

PowerShell Cmdlets or ADO.NET Provider?

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

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

Use the following steps to generate a new API key for authenticating to Streak.

  1. Navigate to Gmail
  2. Click on the Streak dropdown to the right of the search bar
  3. Select the Integrations button. This will open a window where you can view existing integrations and create new API keys.
  4. Under the Streak API section of integrations, click the button to Create New Key.

PowerShell

  1. Install the module:

    Install-Module StreakCmdlets
  2. Connect:

    $streak = Connect-Streak -ApiKey "$ApiKey"
  3. Search for and retrieve data:

    $email = "user@domain.com" $users = Select-Streak -Connection $streak -Table "Users" -Where "Email = `'$Email`'" $users

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

    $users = Invoke-Streak -Connection $streak -Query 'SELECT * FROM Users WHERE Email = @Email' -Params @{'@Email'='user@domain.com'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Streak.StreakConnection("ApiKey=8c84j9b4j54762ce809ej6a782d776j3;") $conn.Open()
  3. Instantiate the StreakDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT UserKey, Email from Users" $da= New-Object System.Data.CData.Streak.StreakDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.userkey $_.email }