Ready to get started?

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

Download Now

Automate QuickBooks Integration Tasks from PowerShell

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

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

Cmdlets or ADO.NET?

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

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

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

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


  1. Install the module:

    Install-Module QuickBooksCmdlets
  2. Connect:

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

    $type = "Commercial" $customers = Select-QB -Connection $quickbooks -Table "Customers" -Where "Type = `'$Type`'" $customers

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

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


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.QuickBooks.QuickBooksConnection("URL=http://remotehost:8166;User=admin;Password=admin123;") $conn.Open()
  3. Instantiate the QuickBooksDataAdapter, execute an SQL query, and output the results:

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

Update QuickBooks Data


Update-QB -Connection $QuickBooks -Columns @('Name','CustomerBalance') -Values @('MyName', 'MyCustomerBalance') -Table Customers -Id "MyId"


$cmd = New-Object System.Data.CData.QuickBooks.QuickBooksCommand("UPDATE Customers SET Type='Commercial' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.QuickBooks.QuickBooksParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert QuickBooks Data


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


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

Delete QuickBooks Data


Remove-QB -Connection $QuickBooks -Table "Customers" -Id "MyId"


$cmd = New-Object System.Data.CData.QuickBooks.QuickBooksCommand("DELETE FROM Customers WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.QuickBooks.QuickBooksParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()