Automate Xero WorkflowMax Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Xero WorkflowMax ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Xero WorkflowMax.

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

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

Cmdlets or ADO.NET?

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

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

To connect to the WorkflowMax API, obtain an APIKey and AccountKey from Xero. This can only be done by contacting Xero support (

After obtaining an API Key and Account Key, set the values in the APIKey and AccountKey connection properties. Once these are set, you are ready to connect.


  1. Install the module:

    Install-Module XeroWorkflowMaxCmdlets
  2. Connect:

    $xeroworkflowmax = Connect-XeroWorkflowMax -APIKey "$APIKey" -AccountKey "$AccountKey"
  3. Search for and retrieve data:

    $name = "Cynthia" $clients = Select-XeroWorkflowMax -Connection $xeroworkflowmax -Table "Clients" -Where "Name = `'$Name`'" $clients

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

    $clients = Invoke-XeroWorkflowMax -Connection $xeroworkflowmax -Query 'SELECT * FROM Clients WHERE Name = @Name' -Params @{'@Name'='Cynthia'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.XeroWorkflowMax.XeroWorkflowMaxConnection("APIKey=myApiKey;AccountKey=myAccountKey;") $conn.Open()
  3. Instantiate the XeroWorkflowMaxDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Id, Name from Clients" $da= New-Object System.Data.CData.XeroWorkflowMax.XeroWorkflowMaxDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $ }

Update Xero WorkflowMax Data


Update-XeroWorkflowMax -Connection $XeroWorkflowMax -Columns @('Id','Name') -Values @('MyId', 'MyName') -Table Clients -Id "MyId"


$cmd = New-Object System.Data.CData.XeroWorkflowMax.XeroWorkflowMaxCommand("UPDATE Clients SET Name='Cynthia' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.XeroWorkflowMax.XeroWorkflowMaxParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert Xero WorkflowMax Data


Add-XeroWorkflowMax -Connection $XeroWorkflowMax -Table Clients -Columns @("Id", "Name") -Values @("MyId", "MyName")


$cmd = New-Object System.Data.CData.XeroWorkflowMax.XeroWorkflowMaxCommand("INSERT INTO Clients (Name) VALUES (@myName)", $conn) $cmd.Parameters.Add(new System.Data.CData.XeroWorkflowMax.XeroWorkflowMaxParameter("@myName","Cynthia")) $cmd.ExecuteNonQuery()

Delete Xero WorkflowMax Data


Remove-XeroWorkflowMax -Connection $XeroWorkflowMax -Table "Clients" -Id "MyId"


$cmd = New-Object System.Data.CData.XeroWorkflowMax.XeroWorkflowMaxCommand("DELETE FROM Clients WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.XeroWorkflowMax.XeroWorkflowMaxParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()