Automate UKG Pro HCM Integration Tasks from PowerShell

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Are you in search of a quick and easy way to access UKG Pro HCM data from PowerShell? This article demonstrates how to utilize the UKG Pro HCM Cmdlets for tasks like connecting to UKG Pro HCM data, automating operations, downloading data, and more.

The CData API Driver for ADO.NET is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to UKG Pro HCM.

ADO.NET Provider

The ADO.NET Provider provides a SQL interface for UKG Pro HCM; this tutorial shows how to use the Provider to retrieve UKG Pro HCM data.

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

Start by setting the Profile connection property to the location of the UKGProHCM Profile on disk (e.g. C:\profiles\UKGProHCM.apip). Next, set the ProfileSettings connection property to the connection string for UKGProHCM (see below).

UKGProHCM API Profile Settings

UKG Pro HCM uses Basic authentication combined with a customer API key to authorize access to the API. To connect, you will need your UKG Pro HCM credentials and a customer API key issued by UKG.

Set the following connection properties to authenticate:

  • AuthScheme: Set this to Basic.
  • User: Set this to your UKG Pro HCM username.
  • Password: Set this to your UKG Pro HCM password.
  • ProfileSettings: Set this to a semicolon-separated list containing:
    • Host: Your UKG Pro HCM tenant hostname (e.g., yourcompany.ultipro.com).
    • CustomerAPIKey: Your UKG customer API key. This is passed as the US-CUSTOMER-API-KEY request header on each API call.

To obtain your customer API key, contact your UKG Pro HCM administrator or refer to the UKG Developer Portal at https://developer.ukg.com.

  1. Load the provider's assembly:

    
    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData API Driver for ADO.NET\lib\System.Data.CData.API.dll")
        
  2. Connect to UKG Pro HCM:

     
    $conn= New-Object System.Data.CData.API.APIConnection("Profile=C:\profiles\UKGProHCM.apip;AuthScheme=Basic;User=your_username;Password=your_password;ProfileSettings='Host=yourcompany.ultipro.com;CustomerAPIKey=your_customer_api_key';")
    $conn.Open()
    
  3. Instantiate the APIDataAdapter, execute an SQL query, and output the results:

    
    $sql="SELECT UserId, UserName from UserDetails"
    
    $da= New-Object System.Data.CData.API.APIDataAdapter($sql, $conn)
    $dt= New-Object System.Data.DataTable
    $da.Fill($dt)
    
    $dt.Rows | foreach {
    	Write-Host $_.userid $_.username
    }
      

Ready to get started?

Connect to live data from UKG Pro HCM with the API Driver

Connect to UKG Pro HCM