![]() |
VOOZH | about |
The CData Cmdlets Module for Paylocity is a standard PowerShell module offering straightforward integration with Paylocity. Below, you will find examples of using our Paylocity Cmdlets with native PowerShell cmdlets.
Set the following to establish a connection to Paylocity:
This property is required for executing Insert and Update statements, and it is not required if the feature is disabled.
Paylocity will decrypt the AES key using RSA decryption.
It is an optional property if the IV value not provided, The driver will generate a key internally.
You must use OAuth to authenticate with Paylocity. OAuth requires the authenticating user to interact with Paylocity using the browser. For more information, refer to the OAuth section in the Help documentation.
The Pay Entry API is completely separate from the rest of the Paylocity API. It uses a separate Client ID and Secret, and must be explicitly requested from Paylocity for access to be granted for an account. The Pay Entry API allows you to automatically submit payroll information for individual employees, and little else. Due to the extremely limited nature of what is offered by the Pay Entry API, we have elected not to give it a separate schema, but it may be enabled via the UsePayEntryAPI connection property.
Please be aware that when setting UsePayEntryAPI to true, you may only use the CreatePayEntryImportBatch & MergePayEntryImportBatchgtable stored procedures, the InputTimeEntry table, and the OAuth stored procedures. Attempts to use other features of the product will result in an error. You must also store your OAuthAccessToken separately, which often means setting a different OAuthSettingsLocation when using this connection property.
$conn = Connect-Paylocity -OAuthClientID "$OAuthClientID" -OAuthClientSecret "$OAuthClientSecret" -RSAPublicKey "$RSAPublicKey" -Key "$Key" -IV "$IV" -InitiateOAuth "$InitiateOAuth"
Follow the steps below to retrieve data from the Employee table and pipe the result into to a CSV file:
Select-Paylocity -Connection $conn -Table Employee | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myEmployeeData.csv -NoTypeInformation
You will notice that we piped the results from Select-Paylocity 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.The following line deletes any records that match the criteria:
Select-Paylocity -Connection $conn -Table Employee -Where "EmployeeId = 1234" | Remove-Paylocity
The cmdlets make data transformation easy as well as data cleansing. The following example loads data from a CSV file into Paylocity, checking first whether a record already exists and needs to be updated instead of inserted.
Import-Csv -Path C:\MyEmployeeUpdates.csv | %{
$record = Select-Paylocity -Connection $Paylocity -Table Employee -Where ("Id = `'"+$_.Id+"`'")
if($record){
Update-Paylocity -Connection $paylocity -Table Employee -Columns ("FirstName","LastName") -Values ($_.FirstName, $_.LastName) -Where ("Id = `'"+$_.Id+"`'")
}else{
Add-Paylocity -Connection $paylocity -Table Employee -Columns ("FirstName","LastName") -Values ($_.FirstName, $_.LastName)
}
}
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!
Download a free trial of the Paylocity Cmdlets to get started:
Download NowLearn more:
👁 Paylocity IconAn easy-to-use set of PowerShell Cmdlets offering real-time access to Paylocity. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.