Ready to get started?

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

 Download Now

Learn more: Icon ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with

Automate Integration Tasks from PowerShell

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

The CData Cmdlets for 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

PowerShell Cmdlets or ADO.NET Driver?

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

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

You must use OAuth to authenticate with Outreach. Set the InitiateOAuth connection property to "GETANDREFRESH". For more information, refer to the OAuth section in the Help documentation.


  1. Install the module:

    Install-Module OutreachCmdlets
  2. Connect:

    $outreach = Connect-Outreach
  3. Search for and retrieve data:

    $industry = "Textiles" $accounts = Select-Outreach -Connection $outreach -Table "Accounts" -Where "Industry = `'$Industry`'" $accounts

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

    $accounts = Invoke-Outreach -Connection $outreach -Query 'SELECT * FROM Accounts WHERE Industry = @Industry' -Params @{'@Industry'='Textiles'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Outreach.OutreachConnection("InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the OutreachDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, NumberOfEmployees from Accounts" $da= New-Object System.Data.CData.Outreach.OutreachDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $_.numberofemployees }

Update Data


Update-Outreach -Connection $Outreach -Columns @('Name','NumberOfEmployees') -Values @('MyName', 'MyNumberOfEmployees') -Table Accounts -Id "MyId"


$cmd = New-Object System.Data.CData.Outreach.OutreachCommand("UPDATE Accounts SET Industry='Textiles' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.Outreach.OutreachParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert Data


Add-Outreach -Connection $Outreach -Table Accounts -Columns @("Name", "NumberOfEmployees") -Values @("MyName", "MyNumberOfEmployees")


$cmd = New-Object System.Data.CData.Outreach.OutreachCommand("INSERT INTO Accounts (Industry) VALUES (@myIndustry)", $conn) $cmd.Parameters.Add(new System.Data.CData.Outreach.OutreachParameter("@myIndustry","Textiles")) $cmd.ExecuteNonQuery()

Delete Data


Remove-Outreach -Connection $Outreach -Table "Accounts" -Id "MyId"


$cmd = New-Object System.Data.CData.Outreach.OutreachCommand("DELETE FROM Accounts WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.Outreach.OutreachParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()