Ready to get started?

Learn more about the CData ADO.NET Provider for Wasabi or download a free trial:

Download Now

Automate Wasabi Integration Tasks from PowerShell

Are you looking for a quick and easy way to access Wasabi data from PowerShell? We show how to use the Cmdlets for Wasabi and the CData ADO.NET Provider for Wasabi to connect to Wasabi data and synchronize, automate, download, and more.

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

Cmdlets or ADO.NET?

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

After obtaining the needed connection properties, accessing Wasabi data in PowerShell consists of three basic steps.

To authorize Wasabi requests, provide the credentials for an administrator account or for an IAM user with custom permissions. Set AccessKey to the access key Id. Set SecretKey to the secret access key.

Note: You can connect as the AWS account administrator, but it is recommended to use IAM user credentials to access AWS services.

For information on obtaining the credentials and other authentication methods, refer to the Getting Started section of the Help documentation.

PowerShell

  1. Install the module:

    Install-Module WasabiCmdlets
  2. Connect:

    $wasabi = Connect-Wasabi -AccessKey "$AccessKey" -SecretKey "$SecretKey"
  3. Search for and retrieve data:

    $name = "TestBucket" $buckets = Select-Wasabi -Connection $wasabi -Table "Buckets" -Where "Name = `'$Name`'" $buckets

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

    $buckets = Invoke-Wasabi -Connection $wasabi -Query 'SELECT * FROM Buckets WHERE Name = @Name' -Params @{'@Name'='TestBucket'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Wasabi.WasabiConnection("AccessKey=a123;SecretKey=s123;") $conn.Open()
  3. Instantiate the WasabiDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, OwnerId from Buckets" $da= New-Object System.Data.CData.Wasabi.WasabiDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.name $_.ownerid }