PowerShell and Dynamics CRM Administration

If you are doing any work at all with Dynamics CRM 2011 or 2013 you need to become a friend of PowerShell.  Because PowerShell can be a really good friend who will save you much time and trouble.

 

The Basics

There are several pre-packaged solutions to help you get started with PowerShell.  Here are a few:

Dynamics CRM SDK

The SDK has several sample scripts in the SampleCode\ps folder that show you how to exercise the PowerShell commandlets that ship with Dynamics CRM 2011 and 2013.

 

Adxstudio ALM Toolkit

http://www.adxstudio.com/products/adxstudio-alm-toolkit/

Is a Lifecycle Management for Microsoft Dynamics CRM Application Solutions with both free and commercial versions.

 

xRM CI Framework

http://waelhamze.com/2013/08/20/automated-crm-deployments-powershell/

Is a development and testing framework that contains several PowerShell components to aid in your development and deployment efforts.

Developing Your Own CommandLets

I have had great success developing my own PowerShell commandlets to perform functions that are customer or job-specific.  Prior to PowerShell, I would have create a .NET Console application. By using PowerShell, I can create a single-use commandlet that I simply plug into my project that will give me the desired functionality.

In most cases, the code you write is fairly small and all you really need is to pass in a CRM OrganizationService object.  I’ll have some posts in the future that describes how to do that.

In the meantime, to get you started, install this package:

PowerShell Tools for Visual Studio

http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597

This will give you some really cool PowerShell functionality within Visual Studio.

And visit this page for instructions on how to get starting writing your own:

Writing a Windows PowerShell Cmdlet

http://msdn.microsoft.com/en-us/library/dd878294(v=vs.85).aspx

Leave a Reply 0 comments