Ready to get started?

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

 Download Now

Learn more:

QuickBooks POS Icon QuickBooks POS ADO.NET Provider

Complete read-write access to QuickBooks Point of Sale enables developers to search (Customers, Transactions, Invoices, Sales Receipts, etc.), update items, edit customers, and more, from any .NET application.

Automate QuickBooks POS Integration Tasks from PowerShell



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

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

PowerShell Cmdlets or ADO.NET Provider?

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

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

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

Requests are made to QuickBooks POS through the Remote Connector. The Remote Connector runs on the same machine as QuickBooks POS 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, you will need to authorize the Remote Connector with QuickBooks POS. See the "Getting Started" chapter of the help documentation for a guide.

PowerShell

  1. Install the module:

    Install-Module QuickBooksPOSCmdlets
  2. Connect:

    $quickbookspos = Connect-QBPOS
  3. Search for and retrieve data:

    $lastname = "Cook" $customers = Select-QBPOS -Connection $quickbookspos -Table "Customers" -Where "LastName = `'$LastName`'" $customers

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

    $customers = Invoke-QBPOS -Connection $quickbookspos -Query 'SELECT * FROM Customers WHERE LastName = @LastName' -Params @{'@LastName'='Cook'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.QuickBooksPOS.QuickBooksPOSConnection("") $conn.Open()
  3. Instantiate the QuickBooksPOSDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT ListId, AccountLimit from Customers" $da= New-Object System.Data.CData.QuickBooksPOS.QuickBooksPOSDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.listid $_.accountlimit }

Update QuickBooks POS Data

PowerShell

Update-QBPOS -Connection $QuickBooksPOS -Columns @('ListId','AccountLimit') -Values @('MyListId', 'MyAccountLimit') -Table Customers -Id "MyListId"

ADO.NET

$cmd = New-Object System.Data.CData.QuickBooksPOS.QuickBooksPOSCommand("UPDATE Customers SET LastName='Cook' WHERE ListId = @myListId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.QuickBooksPOS.QuickBooksPOSParameter("@myListId","10456255-0015501366"))) $cmd.ExecuteNonQuery()

Insert QuickBooks POS Data

PowerShell

Add-QBPOS -Connection $QuickBooksPOS -Table Customers -Columns @("ListId", "AccountLimit") -Values @("MyListId", "MyAccountLimit")

ADO.NET

$cmd = New-Object System.Data.CData.QuickBooksPOS.QuickBooksPOSCommand("INSERT INTO Customers (LastName) VALUES (@myLastName)", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.QuickBooksPOS.QuickBooksPOSParameter("@myLastName","Cook"))) $cmd.ExecuteNonQuery()

Delete QuickBooks POS Data

PowerShell

Remove-QBPOS -Connection $QuickBooksPOS -Table "Customers" -Id "MyListId"

ADO.NET

$cmd = New-Object System.Data.CData.QuickBooksPOS.QuickBooksPOSCommand("DELETE FROM Customers WHERE ListId=@myListId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.QuickBooksPOS.QuickBooksPOSParameter("@myListId","001d000000YBRseAAH"))) $cmd.ExecuteNonQuery()