power-up your deployments using powershell part 2


I showed in my last blog the PowerShell library options available if you are considering continuous integration or rapid deployments for your Dynamics CRM and AdxPortal projects.

I was recently tasked with writing some scripts for performing continuous deployments between two CRM environments that has an AdxPortal component.

Let’s go through a few sample scripts that are beneficial when performing these high level tasks;

  1. Backup SQL database
  2. Deploy Adx Portal by executing MSBuild and triggering the publish process (using a publish profile)
  3. Replace Adx “settings.xml” file based on the environment
  4. Export CRM Solutions from source CRM
  5. Import CRM Solutions to target CRM
  6. Delete Adx Portal Web Site record from target CRM
  7. Execute Adx Web Site Copy tool (pre-saved cmd file)
  8. Importing Configuration records

Just to recap, there are 3 main PowerShell libraries to choose from;

Option 1: Microsoft XRM PowerShell

You can download the Microsoft XRM Tooling based PowerShell library from Script Center. It’s based on the original PowerShell modules and extensions developed by Microsoft Premier Field Engineers (PFEs).

Option 2: Adxstudio ALM Toolkit

This PowerShell library from AdxStudio can be downloaded from the Adxstudio ALM Toolkit page. It contains documentation as to how it can be installed and configured.

Option 3: SQL Server Management Object PowerShell Library

The SQL Server PowerShell library is useful when you need to perform a Dynamics CRM SQL backup or any SQL related task especially if you have an on premise deployment.

Step 1: Create an Environment settings file

This is only an example and just one way of storing environment specific settings; you can easily store these in an XML or JSON file and read dynamically when your script is loading up.


Step 2: Back up CRM


Step 3: Deploy Adx (publish the portal project) – the publish profile could target any kind of deployment (File, FTP, Web Publish & etc)


Step 4: Export and Import CRM Solutions


Step 5: Delete Adx Web Site – delete the site before running the Web Site Copy Tool


Step 6: Importing Configuration Records

While all previous scripts use the Microsoft XRM Tooling PowerShell library, the data exporting and importing script requires the Adx ALM Toolkit cmdlets.

Note: If the XRM tooling library had been loaded previously, you need to remove the module before importing the Adx ALM toolkit module as some of the cmdlets and function names overlap between the two libraries.


There’s a plethora of functions that are included within the 3 libraries (Microsoft XRM, Adx ALM Toolkit and SQL SMO) that you could use to achieve perfect automation for your Dynamics CRM deployment.

Stay tuned for my next blog where I’ll be talking about how to script common admin functions using these aforementioned PowerShell cmdlets.