Automate Bing Search Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Bing Search ADO.NET Provider

Easy-to-use Bing search client enables .NET-based applications to easily search Microsoft Bing and filter search results.

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

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

Cmdlets or ADO.NET?

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

After obtaining the needed connection properties, accessing Bing Search results in PowerShell consists of three basic steps.

To connect to Bing, set the ApiKey connection property. To obtain the API key, sign into Microsoft Cognitive Services and register for the Bing Search APIs.

Two API keys are then generated; select either one.

When querying tables, the SearchTerms parameter must be supplied in the WHERE clause.


  1. Install the module:

    Install-Module BingCmdlets
  2. Connect:

    $bing = Connect-Bing -APIKey "$APIKey"
  3. Search for and retrieve data:

    $searchterms = "WayneTech" $videosearch = Select-Bing -Connection $bing -Table "VideoSearch" -Where "SearchTerms = `'$SearchTerms`'" $videosearch

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

    $videosearch = Invoke-Bing -Connection $bing -Query 'SELECT * FROM VideoSearch WHERE SearchTerms = @SearchTerms' -Params @{'@SearchTerms'='WayneTech'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Bing.BingConnection("APIKey=MyAPIKey;") $conn.Open()
  3. Instantiate the BingDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Title, ViewCount from VideoSearch" $da= New-Object System.Data.CData.Bing.BingDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.title $_.viewcount }