Download Dynamics CRM Tools Using PowerShell

Introduction

In Dynamic 365 CRM or Power Platform, certain tools like Configuration Migration Tool, Package Deployer, Plug-in Registration Tool, Solution Packager tool, and Code Generation Tool are required for every project development. By using the following process one can easily set up to work readily in few minutes.

Step 1

Navigate to Windows Explorer and type Windows PowerShell as shown in the below figure,

Download Dynamics CRM Tools Using PowerShell

Step 2

Click on open as shown in the below figure,

Download Dynamics CRM Tools Using PowerShell

Step 3

After step 2, a new window of PowerShell will get opened as shown below,

Download Dynamics CRM Tools Using PowerShell

Step 4

Create directory by using the following command, here in this example I gave directory[Folder] name as devtools and click on enter, devtools folder gets created as shown below,

Syntax - mkdir <FolderName>

Example

mkdir devtools

Download Dynamics CRM Tools Using PowerShell

Step 5

After step 4, a new folder with the name devtools gets created. Now go to that folder with the below command as shown in the below figure,

Syntax - cd <FolderName>

Ex

cd devtools

Download Dynamics CRM Tools Using PowerShell

Step 6

Now copy the below PowerShell script and paste it in the above window and click on the enter key on the keyboard or just paste it as shown in the following figure below,

Code

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$targetNugetExe = ".\nuget.exe"
Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
Set-Alias nuget $targetNugetExe -Scope Global -Verbose

##
##Download Plugin Registration Tool
##
./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .\Tools
md .\Tools\PluginRegistration
$prtFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.'}
move .\Tools\$prtFolder\tools\*.* .\Tools\PluginRegistration
Remove-Item .\Tools\$prtFolder -Force -Recurse

##
##Download CoreTools
##
./nuget install  Microsoft.CrmSdk.CoreTools -O .\Tools
md .\Tools\CoreTools
$coreToolsFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.CoreTools.'}
move .\Tools\$coreToolsFolder\content\bin\coretools\*.* .\Tools\CoreTools
Remove-Item .\Tools\$coreToolsFolder -Force -Recurse

##
##Download Configuration Migration
##
./nuget install  Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf -O .\Tools
md .\Tools\ConfigurationMigration
$configMigFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf.'}
move .\Tools\$configMigFolder\tools\*.* .\Tools\ConfigurationMigration
Remove-Item .\Tools\$configMigFolder -Force -Recurse

##
##Download Package Deployer 
##
./nuget install  Microsoft.CrmSdk.XrmTooling.PackageDeployment.WPF -O .\Tools
md .\Tools\PackageDeployment
$pdFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PackageDeployment.Wpf.'}
move .\Tools\$pdFolder\tools\*.* .\Tools\PackageDeployment
Remove-Item .\Tools\$pdFolder -Force -Recurse

##
##Download Package Deployer PowerShell module
##
./nuget install Microsoft.CrmSdk.XrmTooling.PackageDeployment.PowerShell -O .\Tools
$pdPoshFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PackageDeployment.PowerShell.'}
move .\Tools\$pdPoshFolder\tools\*.* .\Tools\PackageDeployment.PowerShell
Remove-Item .\Tools\$pdPoshFolder -Force -Recurse

##
##Remove NuGet.exe
##
Remove-Item nuget.exe

Download Dynamics CRM Tools Using PowerShell

Step 7

Now navigate to the folder devtools that was created in step 4 and you could see a folder with the name Tools. Open that Tools folder to see subfolders where we can find separate folders for Configuration Migration, Core Tools, PackageDeployment, PackageDeployment. PowerShell and Plugin Registration folders get created as shown below,

Download Dynamics CRM Tools Using PowerShell

Step 8

Now to test whether the tools are working fine or not, open the Configuration Migration folder and click on DataMigrationUtility.exe as shown in the below figure,

Download Dynamics CRM Tools Using PowerShell

Step 9

After step 8, a new popup window of the DataMigration utility gets opened, click on Create Schema and click on continue as shown below,

Download Dynamics CRM Tools Using PowerShell

Step 10

After step 9, click on continue. The user will be navigated to the next screen. Select the office 365 option and select on Display list of available organizations and click on Login as shown below in the figure,

Download Dynamics CRM Tools Using PowerShell

Step 11

After login in step 10, provide credentials for CRM login it could be trial instance/ dev environment user name and password, and the user will be navigated to the below screen and could see entities gets populated as shown below which confirms tool installed properly.

Download Dynamics CRM Tools Using PowerShell

References

https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/download-tools-nuget?view=op-9-1

Conclusion

In this way, one can easily get CRM tools that are required for development with less time and ready-to-use tools quickly.