Ready to get started?

Learn more about the CData ADO.NET Provider for Reckon or download a free trial:

Download Now

Automate Reckon Integration Tasks from PowerShell

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

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

Cmdlets or ADO.NET?

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

After obtaining the needed connection properties, accessing Reckon data in PowerShell consists of three basic steps.

When you are connecting to a local Reckon instance, you do not need to set any connection properties.

Requests to Reckon are made through the Remote Connector. The Remote Connector runs on the same machine as Reckon and accepts connections through a lightweight, embedded Web server. The server supports SSL/TLS, enabling users to connect securely from remote machines.

The first time you connect to your company file, you will need to authorize the Remote Connector with Reckon. See the "Getting Started" chapter of the help documentation for a guide.

PowerShell

  1. Install the module:

    Install-Module ReckonCmdlets
  2. Connect:

    $reckon = Connect-Reckon -User "$User" -Password "$Password" -URL "$URL"
  3. Search for and retrieve data:

    $type = "Commercial" $customers = Select-Reckon -Connection $reckon -Table "Customers" -Where "Type = `'$Type`'" $customers

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

    $customers = Invoke-Reckon -Connection $reckon -Query 'SELECT * FROM Customers WHERE Type = @Type' -Params @{'@Type'='Commercial'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Reckon.ReckonConnection("User=RCUser;Password=RCUserPassword;URL=http://remotehost:8166;") $conn.Open()
  3. Instantiate the ReckonDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, CustomerBalance from Customers" $da= New-Object System.Data.CData.Reckon.ReckonDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.name $_.customerbalance }

Update Reckon Data

PowerShell

Update-Reckon -Connection $Reckon -Columns @('Name','CustomerBalance') -Values @('MyName', 'MyCustomerBalance') -Table Customers -Id "MyID"

ADO.NET

$cmd = New-Object System.Data.CData.Reckon.ReckonCommand("UPDATE Customers SET Type='Commercial' WHERE ID = @myID", $conn) $cmd.Parameters.Add(new System.Data.CData.Reckon.ReckonParameter("@myID","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert Reckon Data

PowerShell

Add-Reckon -Connection $Reckon -Table Customers -Columns @("Name", "CustomerBalance") -Values @("MyName", "MyCustomerBalance")

ADO.NET

$cmd = New-Object System.Data.CData.Reckon.ReckonCommand("INSERT INTO Customers (Type) VALUES (@myType)", $conn) $cmd.Parameters.Add(new System.Data.CData.Reckon.ReckonParameter("@myType","Commercial")) $cmd.ExecuteNonQuery()

Delete Reckon Data

PowerShell

Remove-Reckon -Connection $Reckon -Table "Customers" -Id "MyID"

ADO.NET

$cmd = New-Object System.Data.CData.Reckon.ReckonCommand("DELETE FROM Customers WHERE ID=@myID", $conn) $cmd.Parameters.Add(new System.Data.CData.Reckon.ReckonParameter("@myID","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()