How to Create MS CRM organizations from file (list) using PowerShell


Create CRM organizations from file (list) using PowerShell

Hello Everyone!

Sometime back I came across need for provisioning a bunch of CRM organizations for users/participants in Test/Lab environment. I had the CRM 2013 deployment and the list of participants but wasn’t really interested in clicking through the new organization wizard for 45+ times. So thought of using CRM 2013 PowerShell cmdlets to get those orgs provisioned. After bit of digging on cmdlets and couple of trial runs I could get a PowerShell Script that takes csv file as parameter and create CRM organization for each name in the parameter file.

Here is an extract of the script that I used for the purpose, full script file is available for download on same post.

 

In above script organization name is same as username and an AD account was created by another PowerShell Script, i.e. - John Doe user’s AD account name is JDoe, Orgname is JDoe and same username is passed as –Sysadmin so user would be added with CRM System Administrator role to his/her organization. TechNet community galleries carries a good document and also samples of scripts that can be used to create AD users from a CSV file. One may also be able to find some good ones with a quick internet search…

Here is how the .csv file looks like that should be passed as parameter for above script. Additional fields can be provided in .csv file as per requirement given the script above is modified to parse/use those fields.

Icing would be to have an IFD enabled CRM deployment. In such case, it becomes necessary to create DNS records for each organization URL. For that, I employed another script which used DNSCMD command to add records consuming same .csv file that was parameter for org creation PowerShell Script. Here is TechNet link that describes DNSCMD and options.

Hope this helps!

Thank you!

Bhavesh Shastri

script.txt

Comments (3)
  1. Mervyn says:

    Great post. Thanks Bhavesh!

  2. Ritesh says:

    Awesome post Bhavesh!

  3. Great to see this resurface again – I haven’t seen since CRM 2011 – Thanks for Sharing !

Comments are closed.

Skip to main content