Ready to get started?

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

 Download Now

Learn more:

Salesloft Icon Salesloft ADO.NET Provider

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

Automate Salesloft Integration Tasks from PowerShell

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

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

PowerShell Cmdlets or ADO.NET Provider?

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

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

SalesLoft authenticates using the OAuth authentication standard or an API Key. OAuth requires the authenticating user to interact with SalesLoft using the browser.

Using OAuth

For OAuth authentication, create an OAuth app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties. See the OAuth section in the Help documentation for an authentication guide.

Using APIKey

Alternatively, you can authenticate with an APIKey. Provision an API key from the SalesLoft user interface: You will receive a Key which will be used when issuing requests.


  1. Install the module:

    Install-Module SalesLoftCmdlets
  2. Connect:

    $salesloft = Connect-SalesLoft -AuthScheme "$AuthScheme" -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackUrl "$CallbackUrl"
  3. Search for and retrieve data:

    $country = "Canada" $accounts = Select-SalesLoft -Connection $salesloft -Table "Accounts" -Where "Country = `'$Country`'" $accounts

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

    $accounts = Invoke-SalesLoft -Connection $salesloft -Query 'SELECT * FROM Accounts WHERE Country = @Country' -Params @{'@Country'='Canada'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.SalesLoft.SalesLoftConnection("AuthScheme=OAuth;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackUrl=http://localhost:33333;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the SalesLoftDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, Name from Accounts" $da= New-Object System.Data.CData.SalesLoft.SalesLoftDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $ }

Update Salesloft Data


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


$cmd = New-Object System.Data.CData.SalesLoft.SalesLoftCommand("UPDATE Accounts SET Country='Canada' WHERE Id = @myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.SalesLoft.SalesLoftParameter("@myId","10456255-0015501366"))) $cmd.ExecuteNonQuery()

Insert Salesloft Data


Add-SalesLoft -Connection $SalesLoft -Table Accounts -Columns @("Id", "Name") -Values @("MyId", "MyName")


$cmd = New-Object System.Data.CData.SalesLoft.SalesLoftCommand("INSERT INTO Accounts (Country) VALUES (@myCountry)", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.SalesLoft.SalesLoftParameter("@myCountry","Canada"))) $cmd.ExecuteNonQuery()

Delete Salesloft Data


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


$cmd = New-Object System.Data.CData.SalesLoft.SalesLoftCommand("DELETE FROM Accounts WHERE Id=@myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.SalesLoft.SalesLoftParameter("@myId","001d000000YBRseAAH"))) $cmd.ExecuteNonQuery()