This module demonstrate on how to automatically setup different theme for your Dynamics365 environment using Powershell module by Microsoft.Xrm.Data.Powershell. Handy if you are administering multiple Dynamics365 environment.
- Update to powershell 4 (https://www.microsoft.com/en-au/download/details.aspx?id=40855) and then install.
- Download Dynamics 365 SDK (https://www.microsoft.com/en-us/download/details.aspx?id=50032 ).
- Run the package file to extract the contents of the package. The PowerShell assembly (Microsoft.Xrm.Tooling.CrmConnector.Powershell.dll) and the script (RegisterXRMTooling.ps1) for registering the cmdlets are located in the \SDK\bin folder in the SDK.
- Start Windows PowerShell on your computer with elevated privileges (run as administrator).
- At the prompt, change your directory to the folder that contains the PowerShelldll file and the script for registering the cmdlets. For example:
cd c:\SDK\bin
- Run the RegisterXRMTooling.ps1 script to register the XRM tooling PowerShell assembly, and install the Windows PowerShell snap-in. Type the following command, and press ENTER:
.\RegisterXRMTooling.ps1
- Add the Windows PowerShell snap-in. This registers the Get-CrmConnection and Get-CrmOrganizations cmdlets.
Add-PSSnapin Microsoft.Xrm.Tooling.Connector
- You’re now ready to use these Windows PowerShell cmdlets. To list the cmdlets that you registered, run the following command in the Windows PowerShell window:
Get-Help “Crm”
- Go to Releases (https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell/releases) and Download Microsoft.Xrm.Data.Powershell.zip.
- Right click the downloaded zip file and click "Properties".
- 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
- %WINDIR%\System32\WindowsPowerShell\v1.0\Modules Following image shows this module copied to User Profile. If you want anyone to use the module on the computer, copy them to System Wide PowerShell module folder instead. If you do not have the folder, you can manually create them.
- As this module is not signed, you may need to change Execution Policy to load the module. You can do so by executing following command.
Set-ExecutionPolicy –ExecutionPolicy RemoteSigned –Scope CurrentUser
- Open PowerShell and run following command to load the module.
Import-Module Microsoft.Xrm.Data.Powershell
- Copy all the ChangeTheme folders
- Upload all the 3 files under /Resources in solutions in your Dynamics instance
- Import the Theme on /Data/CRMTheme_10Colors.csv to Dynamics
- Open the Script /Script/ChangeTheme.ps1. Change the following variable accordingly
| Variable | Description |
|---|---|
| username | your CRM online username |
| orgname | your CRM Organisation Name |
| ThemeGuid | pick the theme you want to automatically switch into |
- Run the script on powershell