Ready to get started?

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

 Download Now

Learn more:

Zoho CRM Icon Zoho CRM ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Zoho CRM account data including Leads, Contacts, Opportunities, Accounts, and more!

Automate Zoho CRM Integration Tasks from PowerShell



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

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

PowerShell Cmdlets or ADO.NET Driver?

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

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

The connector is already registered with Zoho CRM as an OAuth application. As such, OAuth Credentials are embedded by default. If you would prefer to use your own custom OAuth app, see the Custom Credentials section in the Help documentation.

PowerShell

  1. Install the module:

    Install-Module ZohoCRMCmdlets
  2. Connect:

    $zohocrm = Connect-Zoho
  3. Search for and retrieve data:

    $industry = "Data/Telecom OEM" $accounts = Select-Zoho -Connection $zohocrm -Table "Accounts" -Where "Industry = `'$Industry`'" $accounts

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

    $accounts = Invoke-Zoho -Connection $zohocrm -Query 'SELECT * FROM Accounts WHERE Industry = @Industry' -Params @{'@Industry'='Data/Telecom OEM'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.ZohoCRM.ZohoCRMConnection("InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the ZohoCRMDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Account_Name, Annual_Revenue from Accounts" $da= New-Object System.Data.CData.ZohoCRM.ZohoCRMDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.account_name $_.annual_revenue }

Update Zoho CRM Data

PowerShell

Update-Zoho -Connection $ZohoCRM -Columns @('Account_Name','Annual_Revenue') -Values @('MyAccount_Name', 'MyAnnual_Revenue') -Table Accounts -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.ZohoCRM.ZohoCRMCommand("UPDATE Accounts SET Industry='Data/Telecom OEM' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.ZohoCRM.ZohoCRMParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert Zoho CRM Data

PowerShell

Add-Zoho -Connection $ZohoCRM -Table Accounts -Columns @("Account_Name", "Annual_Revenue") -Values @("MyAccount_Name", "MyAnnual_Revenue")

ADO.NET

$cmd = New-Object System.Data.CData.ZohoCRM.ZohoCRMCommand("INSERT INTO Accounts (Industry) VALUES (@myIndustry)", $conn) $cmd.Parameters.Add(new System.Data.CData.ZohoCRM.ZohoCRMParameter("@myIndustry","Data/Telecom OEM")) $cmd.ExecuteNonQuery()

Delete Zoho CRM Data

PowerShell

Remove-Zoho -Connection $ZohoCRM -Table "Accounts" -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.ZohoCRM.ZohoCRMCommand("DELETE FROM Accounts WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.ZohoCRM.ZohoCRMParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()