Automate Google Search Integration Tasks from PowerShell

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Are you in search of a quick and easy way to access Google Search results from PowerShell? This article demonstrates how to utilize the Google Search Cmdlets for tasks like connecting to Google Search results, automating operations, downloading data, and more.

The CData ADO.NET Provider for Google Search is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Google Search.

ADO.NET Provider

The ADO.NET Provider provides a SQL interface for Google Search; this tutorial shows how to use the Provider to retrieve Google Search results.

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

To search with a Google custom search engine, you need to set the CustomSearchId and ApiKey connection properties.

To obtain the CustomSearchId property, sign into Google Custom Search Engine and create a new search engine.

To obtain the ApiKey property, you must enable the Custom Search API in the Google API Console.

  1. Load the provider's assembly:

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

     
    $conn= New-Object System.Data.CData.GoogleSearch.GoogleSearchConnection("CustomSearchId=def456;ApiKey=abc123;")
    $conn.Open()
    
  3. Instantiate the GoogleSearchDataAdapter, execute an SQL query, and output the results:

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

Ready to get started?

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

 Download Now

Learn more:

Google Search Icon Google Search ADO.NET Provider

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