Posts Tagged ‘Microsoft.Xrm.Data.Powershell’

Get help on Microsoft.Xrm.Data.Powershell module functions

Microsoft.Xrm.Data.PowerShell module is an open source library using which you can seamlessly connect to Datavesre API from PowerShell script and carry out Create, Read, Update, and Delete (CRUD) operations.

I’ve been using Microsoft.Xrm.Data.PowerShell module in my Azure DevOps pipelines to perform custom actions.

In this article, I will show you a quick way to get the list of all available functions in Microsoft.Xrm.Data.PowerShell module and the syntax of each function using PowerShell console.

What is Microsoft.Xrm.Data.PowerShell

  • Microsoft.Xrm.Data.PowerShell is an open source library.
  • Microsoft.Xrm.Data.PowerShell builds from Microsoft.Xrm.Tooling.CrmConnector.Powershell and provides common functions to create, delete, query, and update data.
  • This library also includes helpful functions for common tasks such as publishing, and manipulating System & CRM User Settings, etc.
  • The module will function for both Dynamics CRM Online and On-Premise environments. 

Use PowerShell console to fetch Microsoft.Xrm.Data.PowerShell functions:

We will be using PowerShell console to get the list of functions and their syntax.

  • Open the ‘PowerShell’ console
Import-Module Microsoft.Xrm.Data.PowerShell
Get-Command -Module Microsoft.Xrm.Data.PowerShell

Executing the above command fetches the list of all available functions.

  • Now to get help of any particular function, use the following command
Get-Help <function-name> -detailed

For example, to know the usage and syntax of Set-CrmRecord function, command is Get-Help Set-CrmRecord -detailed

These commands could literally save ton of time while either building the function or troubleshooting the syntax errors.