Automate HCL Domino Integration Tasks from PowerShell



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

The CData Cmdlets for HCL Domino are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to HCL Domino.

PowerShell Cmdlets or ADO.NET Provider?

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

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

Connecting to Domino

To connect to Domino data, set the following properties:

  • URL: The host name or IP of the server hosting the Domino database. Include the port of the server hosting the Domino database. For example: http://sampleserver:1234/
  • DatabaseScope: The name of a scope in the Domino Web UI. The driver exposes forms and views for the schema governed by the specified scope. In the Domino Admin UI, select the Scopes menu in the sidebar. Set this property to the name of an existing scope.

Authenticating with Domino

Domino supports authenticating via login credentials or an Azure Active Directory OAuth application:

Login Credentials

To authenticate with login credentials, set the following properties:

  • AuthScheme: Set this to "OAuthPassword"
  • User: The username of the authenticating Domino user
  • Password: The password associated with the authenticating Domino user

The driver uses the login credentials to automatically perform an OAuth token exchange.

AzureAD

This authentication method uses Azure Active Directory as an IdP to obtain a JWT token. You need to create a custom OAuth application in Azure Active Directory and configure it as an IdP. To do so, follow the instructions in the Help documentation. Then set the following properties:

  • AuthScheme: Set this to "AzureAD"
  • InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
  • OAuthClientId: The Client ID obtained when setting up the custom OAuth application.
  • OAuthClientSecret: The Client secret obtained when setting up the custom OAuth application.
  • CallbackURL: The redirect URI defined when you registered your app. For example: https://localhost:33333
  • AzureTenant: The Microsoft Online tenant being used to access data. Supply either a value in the form companyname.microsoft.com or the tenant ID.

    The tenant ID is the same as the directory ID shown in the Azure Portal's Azure Active Directory > Properties page.

PowerShell

  1. Install the module:

    Install-Module DominoCmdlets
  2. Connect:

    $domino = Connect-Domino -Server "$Server" -AuthScheme "$AuthScheme" -User "$User" -Password "$Password"
  3. Search for and retrieve data:

    $city = "Miami" $byname = Select-Domino -Connection $domino -Table "ByName" -Where "City = `'$City`'" $byname

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

    $byname = Invoke-Domino -Connection $domino -Query 'SELECT * FROM ByName WHERE City = @City' -Params @{'@City'='Miami'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Domino.DominoConnection("Server=https://domino.corp.com;AuthScheme=OAuthPassword;User=my_domino_user;Password=my_domino_password;") $conn.Open()
  3. Instantiate the DominoDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Name, Address from ByName" $da= New-Object System.Data.CData.Domino.DominoDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.name $_.address }

Ready to get started?

Download a free trial of the HCL Domino Data Provider to get started:

 Download Now

Learn more:

HCL Domino Icon HCL Domino ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with HCL Domino.