Ready to get started?

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

 Download Now

Learn more:

Tally Icon Tally ADO.NET Provider

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

Automate Tally Integration Tasks from PowerShell



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

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

PowerShell Cmdlets or ADO.NET Provider?

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

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

Set the following connection properties to connect to Tally Instance:

  • Url: Set this to the URL for your Tally instance. For example: http://localhost:9000.

PowerShell

  1. Install the module:

    Install-Module TallyCmdlets
  2. Connect:

    $tally = Connect-Tally -Url "$Url"
  3. Search for and retrieve data:

    $companynumber = "1000" $company = Select-Tally -Connection $tally -Table "Company" -Where "CompanyNumber = `'$CompanyNumber`'" $company

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

    $company = Invoke-Tally -Connection $tally -Query 'SELECT * FROM Company WHERE CompanyNumber = @CompanyNumber' -Params @{'@CompanyNumber'='1000'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Tally.TallyConnection("Url='http://localhost:9000'") $conn.Open()
  3. Instantiate the TallyDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, Address from Company" $da= New-Object System.Data.CData.Tally.TallyDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.name $_.address }