Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →How to pipe Certinia Data to CSV in PowerShell
Use standard PowerShell cmdlets to access Certinia tables.
The CData Cmdlets Module for Certinia is a standard PowerShell module offering straightforward integration with Certinia. Below, you will find examples of using our Certinia Cmdlets with native PowerShell cmdlets.
Creating a Connection to Your Certinia Data
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:
- Log in to Certinia and enter "Network Access" in the Quick Find box in the setup section.
- Add your IP address to the list of trusted IP addresses.
To obtain the security token:
- Open the personal information page on certinia.com.
- Click the link to reset your security token. The token will be emailed to you.
- 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.
$conn = Connect-Certinia -User "$User" -Password "$Password" -Security Token "$Security Token"
Selecting Data
Follow the steps below to retrieve data from the Account table and pipe the result into to a CSV file:
Select-Certinia -Connection $conn -Table Account | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myAccountData.csv -NoTypeInformation
You will notice that we piped the results from Select-Certinia into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.
The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.Deleting Data
The following line deletes any records that match the criteria:
Select-Certinia -Connection $conn -Table Account -Where "Industry = Floppy Disks" | Remove-Certinia
Inserting and Updating Data
The cmdlets make data transformation easy as well as data cleansing. The following example loads data from a CSV file into Certinia, checking first whether a record already exists and needs to be updated instead of inserted.
Import-Csv -Path C:\MyAccountUpdates.csv | %{ $record = Select-Certinia -Connection $Certinia -Table Account -Where ("Id = `'"+$_.Id+"`'") if($record){ Update-Certinia -Connection $certinia -Table Account -Columns ("BillingState","Name") -Values ($_.BillingState, $_.Name) -Where ("Id = `'"+$_.Id+"`'") }else{ Add-Certinia -Connection $certinia -Table Account -Columns ("BillingState","Name") -Values ($_.BillingState, $_.Name) } }
As always, our goal is to simplify the way you connect to data. With cmdlets users can install a data module, set the connection properties, and start building. Download Cmdlets and start working with your data in PowerShell today!