Cmdlets for Tally

Build 25.0.9434

Establishing a Connection

With the CData Cmdlets users can install a data module, set the connection properties, and start scripting. This section provides examples of using our Tally Cmdlets with native PowerShell cmdlets, like the CSV import and export cmdlets.

Connecting to Tally

Set the following connection properties to connect to Tally Instance:

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

Creating a Connection Object

You can then use the Connect-Tally cmdlet to create a connection object that can be passed to other cmdlets:

$conn = Connect-Tally -Url "http://localhost:9000"

Retrieving Data

The Select-Tally cmdlet provides a native PowerShell interface for retrieving data:

$results = Select-Tally -Connection $conn -Table "Company" -Columns @("Name, Address") -Where "CompanyNumber='1000'"
The Invoke-Tally cmdlet provides an SQL interface. This cmdlet can be used to execute an SQL query via the Query parameter.

Piping Cmdlet Output

The cmdlets return row objects to the pipeline one row at a time. The following line exports results to a CSV file:

Select-Tally -Connection $conn -Table Company -Where "CompanyNumber = '1000'" | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myCompanyData.csv -NoTypeInformation

You will notice that we piped the results from Select-Tally into a Select-Object cmdlet and excluded some properties before piping them into an Export-CSV cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each row object in the result set, and we do not necessarily want that information in our CSV file.

However, this makes it easy to pipe the output of one cmdlet to another. The following is an example of converting a result set to JSON:

 
PS C:\> $conn  = Connect-Tally -Url "http://localhost:9000"
PS C:\> $row = Select-Tally -Connection $conn -Table "Company" -Columns (Name, Address) -Where "CompanyNumber = '1000'" | select -first 1
PS C:\> $row | ConvertTo-Json
{
  "Connection":  {

  },
  "Table":  "Company",
  "Columns":  [

  ],
  "Name":  "MyName",
  "Address":  "MyAddress"
} 

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 25.0.9434