As described in the introduction, the Microsoft.Xrm.Data.PowerShell extensions are required to run the script, which require PowerShell x64 version 4.0 or above.
Here are the steps for the installation:
- Download the latest version in the ZIP file format from the GitHub repository at https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell/releases/. At the time of writing, the latest version for Dynamics 365 is 2.5.
- Once downloaded, right-click on the ZIP file and tick the unblock checkbox, as shown in following screenshot:
- Extract the compressed files into %WINDIR%System32WindowsPowerShellv1.0ModulesMicrosoft.Xrm.Data.PowerShell.
- Launch a PowerShell console and import the newly downloaded module by running the following command:
Import-Module Microsoft.Xrm.Data.Powershell
...And now you will be ready to start.
If you receive an error stating Import-Module: Could not load file or assembly, you most likely forgot to unblock the downloaded assemblies, as mentioned in step 2 above.
Note that if you are running a script, ensure that you have script execution permissions by running a Set-ExecutionPolicy command, for example, Set-ExecutionPolicy RemoteSigned. Alternatively, you'll need to pass the -ExecutionPolicy Bypass each time you run a script.
The latest installation instructions can be found at https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell.