Follow Us:
With the recent highly anticipated release of CRM 2011, you now have the ability to manage some parts of Dynamics CRM 2011 with PowerShell! Ok not entirely, but it is a great start from Microsoft to providing the incredible flexibility of PowerShell to Dynamics CRM. More specifically, you are able to script deployment management tasks only. For the time being, you can only run PowerShell with CRM on-premise, NOT CRM Online. Currently the functionality of PowerShell for CRM 2011 is limited, so this mostly would pertain to either to large organizations, or companies that do CRM hosting through SPLA agreements. With these new PowerShell cmdlets, you are able to do things like:
When working with PowerShell, I will always recommend using the PowerShell ISE application. It's a feature included in PowerShell 2.0, which is in Windows Server 2008 R2 and Windows 7 (or if you download PowerShell 2.0). It beats the regular PowerShell command window by a mile. In Windows Server, go to Server Manager –> Features –> and check the box for Windows PowerShell Integrated Scripting Environment (ISE).
Once installed, it’s accessible under Start –> Accessories –> Windows PowerShell –> Windows PowerShell ISE. There’s loads of good info already out there on PowerShell in general, so I won’t reiterate them here. Now that we have that out of the way … on to CRM!
Now you’ve got your powerful ISE application open, let’s see what we can do. As with SharePoint, you need to load the CRM PowerShell snapin dll file into the PowerShell console. This snapin is what provides all of the cmdlets you will use in your commands and scripts. Let’s load the snapin:
Add-PSSnapin Microsoft.Crm.PowerShell
Let’s see what commands we have. The first command will return all cmdlets, and format it in a simple table view showing only the name. If you want more detail, try the second command:
Get-Command -PSSnapin "Microsoft.Crm.PowerShell" | format-table name
Get-Command -PSSnapin "Microsoft.Crm.PowerShell" | select name, definition | format-list
It returns a simple list of all the cmdlets as below:
Name ---- Disable-CrmOrganization Disable-CrmServer Edit-CrmOrganization Enable-CrmOrganization Enable-CrmServer Get-CrmCertificate Get-CrmDefaultOrganization Get-CrmDeploymentAdministrator Get-CrmEtmSettings Get-CrmLicenseProperty Get-CrmOrganization Get-CrmServer Get-CrmSetting Get-CrmThrottleSettings Import-CrmOrganization New-CrmDeploymentAdministrator New-CrmOrganization Remove-CrmCertificate Remove-CrmDeploymentAdministrator Remove-CrmOrganization Remove-CrmServer Set-CrmCertificate Set-CrmEtmSettings Set-CrmProductKey Set-CrmSetting Set-CrmThrottleSettings Update-CrmOrganization
How many is that? Count it!
(Get-Command -PSSnapin "Microsoft.Crm.PowerShell").count
If you want more information on any command, you can use the following:
Get-Help <cmdlet> –detailed
Unlike other products however, they neglected to type out an explanation of the command or give examples. To get some explanations of the commands, you can refer to the newly updated CRM 2011 SDK.
So what can we do with these cmdlets? Let’s look at some possibilities:
Another reason to download the SDK is to get the sample PowerShell scripts that are included. Here’s what provided:
I noticed 2 in particular, configure claims and configure IFD. Nice! I highly encourage you to get in there and dig in for yourself. The PowerShell goodness only gets better from here! Here are some more PowerShell resources:
Be sure to check out our recent webcast on CRM 2011 for Administrators on our C5 tube channel!
Interesting article. You point to the ISE, while I agree it is great to have access to it when nothing else is available but be careful. If you plan to develop scripts with ISE you will not be able to digitally sign them.
jkavannagh58: this is perfectly possible to sign script with ISE. The issue is with encoding (Big Endian by default), there are plenty of workaround and other ISE extension to enable signing right into ISE.
Good Article
The complementary paper includes over 12 years of research, recent survey results, and CRM turnaround success stories.
Request Download
This 60-second assessment is designed to evaluate your organization's collaboration readiness.
Learn how you rank compared to organizations typically in years 1 to 5 of implementation - and which areas to focus on to improve.
This is a sandbox solution which can be activated per site collection to allow you to easily collect feedback from users into a custom Feedback list.
Whether you are upgrading to SharePoint Online, 2010, 2013 or the latest 2016, this checklist contains everything you need to know for a successful transition.