Ready to get started?

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

 Download Now

Learn more:

LinkedIn Ads Icon LinkedIn Ads ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with LinkedIn Ads.

Automate LinkedIn Ads Integration Tasks from PowerShell

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

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

PowerShell Cmdlets or ADO.NET Driver?

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

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

LinkedIn Ads uses the OAuth authentication standard. OAuth requires the authenticating user to interact with LinkedIn using the browser. See the OAuth section in the Help documentation for a guide.


  1. Install the module:

    Install-Module LinkedInAdsCmdlets
  2. Connect:

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

    $entityid = "238" $analytics = Select-LinkedInAds -Connection $linkedinads -Table "Analytics" -Where "EntityId = `'$EntityId`'" $analytics

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

    $analytics = Invoke-LinkedInAds -Connection $linkedinads -Query 'SELECT * FROM Analytics WHERE EntityId = @EntityId' -Params @{'@EntityId'='238'}


  1. Load the provider's assembly:

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

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

    $sql="SELECT VisibilityCode, Comment from Analytics" $da= New-Object System.Data.CData.LinkedInAds.LinkedInAdsDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.visibilitycode $_.comment }