Automate Salesforce Chatter Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Chatter ADO.NET Provider

A straightforward interface to connect any .NET application with Salesforce Chatter integration capabilities including Comments, Groups, Feeds, and more!

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

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

Cmdlets or ADO.NET?

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

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

Salesforce Chatter uses OAuth 2.0 authentication. To authenticate to Salesforce Chatter via OAuth 2.0, you will need to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL by registering an app with Salesforce Chatter.


  1. Install the module:

    Install-Module SalesforceChatterCmdlets
  2. Connect:

    $salesforcechatter = Connect-SalesforceChatter -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackURL "$CallbackURL"
  3. Search for and retrieve data:

    $searchterms = "Smoked*BBQ" $users = Select-SalesforceChatter -Connection $salesforcechatter -Table "Users" -Where "SearchTerms = `'$SearchTerms`'" $users

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

    $users = Invoke-SalesforceChatter -Connection $salesforcechatter -Query 'SELECT * FROM Users WHERE SearchTerms = @SearchTerms' -Params @{'@SearchTerms'='Smoked*BBQ'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.SalesforceChatter.SalesforceChatterConnection("OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:343343;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the SalesforceChatterDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, PostCount from Users" $da= New-Object System.Data.CData.SalesforceChatter.SalesforceChatterDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $_.postcount }