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.

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.

Prerequisites

The connector requires the Proton component to be installed. Normally, Proton is distributed as part of the AppDev pack. See the HCL documentation for instructions on acquiring and installing Proton or the AppDev pack.

Once the Proton service is installed and running, you will also need to create a user account and download its Internet certificate. This certificate can be used to set the connector certificate connection properties.

Authenticating to Domino

  • Server: The name or IP address of the server running Domino with the Proton service.
  • Port: The port number that the Proton service is listening on.
  • Database: The name of the database file, including the .nsf extension.
  • SSLClientCertType: This must match the format of the certificate file. Typically this will be either PEMKEY_FILE for .pem certificates or PFXFILE for .pfx certificates.
  • SSLClientCert: The path to the certificate file.
  • SSLServerCert: This can be set to (*) if you trust the server. This is usually the case, but if you want to perform SSL validation, you may provide a certificate or thumbprint instead. See the documentation for SSLServerCert for details.

Additional Server Configuration

The connector supports querying Domino views if any are defined. Before views can be queried by the connector they must be registered with the design catalog.

Please refer to the Catalog Administration section of the AppDev pack documentation for details on how to do this.

PowerShell

  1. Install the module:

    Install-Module DominoCmdlets
  2. Connect:

    $domino = Connect-Domino -Server "$Server" -Database "$Database" -Port "$Port" -SSLClientCertType "$SSLClientCertType" -SSLClientCert "$SSLClientCert" -SSLServerCert "$SSLServerCert"
  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;Database=names.nsf;Port=3002;SSLClientCertType=PEMKEY_FILE;SSLClientCert=full_path_of_certificate.pem;SSLServerCert=*") $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 }