Ready to get started?

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

 Download Now

Learn more:

Certinia Icon Certinia ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Certinia.

Automate Certinia Integration Tasks from PowerShell



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

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

PowerShell Cmdlets or ADO.NET Provider?

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

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

There are several authentication methods available for connecting to Certinia: login credentials, SSO, and OAuth.

Authenticating with a Login and Token

Set the User and Password to your login credentials. Additionally, set the SecurityToken. By default, the SecurityToken is required, but you can make it optional by allowing a range of trusted IP addresses.

To disable the security token:

  1. Log in to Certinia and enter "Network Access" in the Quick Find box in the setup section.
  2. Add your IP address to the list of trusted IP addresses.

To obtain the security token:

  1. Open the personal information page on certinia.com.
  2. Click the link to reset your security token. The token will be emailed to you.
  3. Specify the security token in the SecurityToken connection property or append it to the Password.

Authenticating with OAuth

If you do not have access to the user name and password or do not want to require them, use the OAuth user consent flow. See the OAuth section in the Help for an authentication guide.

Connecting to Certinia Sandbox Accounts

Set UseSandbox to true (false by default) to use a Certinia sandbox account. Ensure that you specify a sandbox user name in User.

PowerShell

  1. Install the module:

    Install-Module CertiniaCmdlets
  2. Connect:

    $certinia = Connect-Certinia -User "$User" -Password "$Password" -Security Token "$Security Token"
  3. Search for and retrieve data:

    $industry = "Floppy Disks" $account = Select-Certinia -Connection $certinia -Table "Account" -Where "Industry = `'$Industry`'" $account

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

    $account = Invoke-Certinia -Connection $certinia -Query 'SELECT * FROM Account WHERE Industry = @Industry' -Params @{'@Industry'='Floppy Disks'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Certinia.CertiniaConnection("User=myUser;Password=myPassword;Security Token=myToken;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the CertiniaDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT BillingState, Name from Account" $da= New-Object System.Data.CData.Certinia.CertiniaDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.billingstate $_.name }

Update Certinia Data

PowerShell

Update-Certinia -Connection $Certinia -Columns @('BillingState','Name') -Values @('MyBillingState', 'MyName') -Table Account -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.Certinia.CertiniaCommand("UPDATE Account SET Industry='Floppy Disks' WHERE Id = @myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Certinia.CertiniaParameter("@myId","10456255-0015501366"))) $cmd.ExecuteNonQuery()

Insert Certinia Data

PowerShell

Add-Certinia -Connection $Certinia -Table Account -Columns @("BillingState", "Name") -Values @("MyBillingState", "MyName")

ADO.NET

$cmd = New-Object System.Data.CData.Certinia.CertiniaCommand("INSERT INTO Account (Industry) VALUES (@myIndustry)", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Certinia.CertiniaParameter("@myIndustry","Floppy Disks"))) $cmd.ExecuteNonQuery()

Delete Certinia Data

PowerShell

Remove-Certinia -Connection $Certinia -Table "Account" -Id "MyId"

ADO.NET

$cmd = New-Object System.Data.CData.Certinia.CertiniaCommand("DELETE FROM Account WHERE Id=@myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Certinia.CertiniaParameter("@myId","001d000000YBRseAAH"))) $cmd.ExecuteNonQuery()