PowerShell & Dynamics 365 (Part ll): Let’s connect!

This second part of the series shows step by step, how to setup a connection with Dynamics 365 and create a simple account.

1. Have a look at Part l to setup the basis.
2. Open the “Windows PowerShell ISE”:
3. Import the module
# import the module

Import-Module Microsoft.Xrm.Data.Powershell

4. Connect to the Org:

# connect to a dynamics 365 organisation 
Connect-CrmOnlineDiscovery –InteractiveMode

This will show a modal dialog where you can access the CRM (Online or OnPrem):


Click “Login” to get the available orgs and then click “Login” again to setup the connection to Dynamics 365.

After successful login the prompt shows you information about your organisation:


4. And now, let us create some data! The following command will create a simple account and return the GUID:
$accountId = New-CrmRecord -conn $CRMConn -EntityLogicalName account -Fields @{"name"="proCRM";"telephone1"="123-456"}

That’s it for today. The next post will show how to get data from CRM by PowerShell

PowerShell & Dynamics 365 (Part l): Setup the basis!

This is the first part of a blog post series about PowerShell together with Dynamics 365 (CRM).

Why PowerShell?

PowerShell-Commands are useful in many cases. Here a short overview what PowerShell can do:

  • Read/Write CRM-settings
  • CRUD CRM-records
  • Do complex data-modification without coding
  • Setup organization
  • and a lotmore!

Let’s start

1. Download the newest version of the “Microsoft.Xrm.Data.PowerShell”-Module: https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell/releases
2. Right click the downloaded zip file and click “Properties”.
3. Check “Unblock” checkbox and click “OK”, or simply click “Unblock” button depending on OS versions:

Extract the zip file and copy “Microsoft.Xrm.Data.PowerShell” folder to one of the following folders:
”%USERPROFILE%\Documents\WindowsPowerShell\Modules” or “%WINDIR%\System32\WindowsPowerShell\v1.0\Modules”

That’s it, we are ready. The next post of this series will show how to create a connection to a Dynamics 365 organization. Stay tuned!

(Source for this blog entry and more information: https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell)