Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2021 Release Wave 2Discover the latest updates and new features releasing from October 2021 through March 2022.
2021 release wave 2 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Have you ever had the need to install the CRM Outlook client to a new batch of users? Or had a CRM upgrade and wanted all of your users to have their client upgraded as well?
Well, you have a few different options:
Before beginning to create your script, first decide what are all the steps that you want to include. Can you assume that everyone who uses it will have all the necessary prerequisites needed for the installation? Probably not. So here are some basic overall items to include:
Before getting started, you will likely need a shared folder location that all of your users have access to. They will also need rights to be able to run a batch file from that shared folder. One potential benefit of this is that you may have an environment that users do not have local administrator rights to their workstations, but a script running from your network can run in elevated privileges. You can also run it in the user’s context, which becomes extremely helpful when we get to the step below of configuring to a CRM org.
The steps shown in this blog detail an installation done from a shared drive. If that does not work for your users, another option will be to create the script and place it, along with the Outlook Client installation files, in a location that someone can download it and run it, but you will have to modify some of the steps below.
You will also need to create your config file, which is pretty straight forward to do. When you install CRM, in the installation folder, you will see a file called default_config.xml. You will need to edit it to add any orgs you want to configure to.
Here the deployment section in the file. You will need to it the server URL and the org name. You can also configure additional parameters. In our example below, we have created our config file and named it crm.xml.
If you try to install, configure, or update CRM for Outlook while Outlook is running, you may run into problems. So it is generally suggested to have Outlook closed while this is happening. Therefore, the first thing we may want to add is a quick check for running processes, and if Outlook.exe is running, then prompt the user to close it and retry.
::begin check if Outlook is currently running
tasklist /fi “imagename eq outlook.exe” | find /i /n “outlook.exe” 1> NUL
if not “%errorlevel%”==”0” goto outlooknotrunning
echo Please close Microsoft Outlook before proceeding.
The key here is the tasklist command, that checks if outlook.exe is currently a running process by piping it through a find command. We also redirect the command output (1>NUL), otherwise it would still work, but it would display a less-than-helpful error message to the user.
The commands above would put the user in a loop that tells them to close Outlook, and then press a key to continue.
You can run the installation directly from the network drive. But that may be extremely slow for end users, especially if they are working from home on a VPN line. So to minimize network performance issues, our recommendation is to copy the installation files from a network, and do all the work locally on the user’s workstation. So for this purpose, we are going to create a folder in the user’s home directory, where we will copy the files to so we can install it from there.
echo Beginning CRM installation. This process may take up to 15 minutes. Please do not open Microsoft Outlook until the installation has completed.
::create local temporary folder
Here, we are setting the installation path directory since we are going to be copying files from there in the next step, and we are also creating a folder called outlook-install-temp in the user’s home directory.
This may be the trickiest part of the entire thing. You may be in luck and have all of your users be in the same Outlook version, and same bit version, at which point you can skip this step entirely. But if you have a mix of Outlook 2007 (I hope not), 2010, 2013, and newer, with a mix of 32 and 64 bit … you are also in luck because we can help you!
First, from a high level, determine how do we want to specify which order of Outlook versions we should check? This may be important in scenarios where multiple versions of Outlook were installed, and old versions may not have been cleaned up completely. And we are checking for the bitversion for that specific Outlook version. For example, let’s say that our order will be: check bit version for Outlook 2010, and if it’s not installed, check bit version for Outlook 2013. If we don’t find neither Outlook 2010 nor 2013 installed, we are going to abandon the installation.
::begin bit check
echo Checking Outlook version.
::query Office 2010 bit key and copy to temp file
reg query HKLM\SOFTWARE\Microsoft\Office\14.0\Outlook /v bitness 1>bitcheck2010.txt 2>error2010.txt
for /f “tokens=2* delims= ” %%a in (bitcheck2010.txt) do set bitcheck=%%b
if %bitcheck%==x86 goto 32bit
if %bitcheck%==x64 goto 64bit
The reg command allows us to view the registry and check if a value exists. Combined with another for command, we can query that actual value and do a comparison, and determining whether we should proceed with a 32-bit or 64-bit install. If Outlook 2010 is not installed, then we don’t do anything yet, and proceed to the next step.
::did not find office 2010, now checking office 2013
reg query HKLM\SOFTWARE\Microsoft\Office\15.0\Outlook /v bitness 1>bitcheck2013.txt 2>error2013.txt
for /f “tokens=2* delims= ” %%a in (bitcheck2013.txt) do set bitcheck=%%b
echo No compatible version of Outlook has been found.
Now we do exactly the same thing, but instead query the Office 2013 hive, which is 15.0. If we find bit check exists, when we go to the appropriate version of 32 or 64 bit. If we do not find Outlook 2013 installed, then we abandon the installation (enderror).
Now the installation can resume on the appropriate bit version that has been installed. Our next step is to copy the files over locally.
echo Found 32-bit Outlook.
set config-path=C:\Program Files (x86)\Microsoft Dynamics CRM\Client\ConfigWizard
::copy install and config files
echo Copying network installation files.
copy /y /z %install-path%\CRM2016-Client-ENU-i386.exe .\client.exe
copy /y /z %install-path%\CRM2016-Client-KB3154952-ENU-i386.exe .\patch.exe
copy /y /z %install-path%\crm.xml .
echo Found 64-bit Outlook.
set config-path=C:\Program Files\Microsoft Dynamics CRM\Client\ConfigWizard
::copy install and config files
echo Copying network installation files.
copy /y /z %install-path%\CRM2016-Client-ENU-amd64.exe .\client.exe
copy /y /z %install-path%\CRM2016-Client-KB3154952-ENU-amd64.exe .\patch.exe
copy /y /z %install-path%\crm.xml .
Now here, we are doing a couple of things. Depending on whether we found 32-bit or 64-bit Outlook, we are copying the appropriate installation files to the local directory we previously created. We copy the CRM installation file, service pack 1 (covered later), and configuration file that we mentioned earlier. We also renamed the install and sp1 files in this step to a generic name. This allows us to do the remaining steps with the same command line, regardless of which bit version we are installing. Quick tip: you can use the /z command to specify a network copy. The benefit is that it adds a progress indicator while copying.
Now it’s the easy part! Yes, the installation is actually quite simple. We basically do 2 thing: extract the contents, and then run the installation.
echo Extracting installation files.
client.exe /quiet /passive /extract:.
::install using quiet switch and config file
echo Installing CRM.
Using the /quiet and /passive switches will install and extract it in the background without any user interaction, which is perfect for a batch file install.
Do you need to set a HomeRealmUrl? (covered here: http://www.powerobjects.com/2015/07/08/configuring-outlook-client-for-microsoft-dynamics-crm-via-a-second-federation/)
Now is the time for a registry addition. For example, this command will set the HomeRealmUrl:
::configure login via Federation
echo Adding configuration for login.
reg add HKLM\Software\Policies\Microsoft\MSCRMClient /f
reg add HKLM\Software\Policies\Microsoft\MSCRMClient /v HomeRealmUrl /t reg_sz /d https://login.consoso.com/adfs/services/trust/mex /f
What if you want to enable certain Internet Option settings, or add a domain to a trusted site? This is all doable here from the reg command once you find the correct registry location.
The CRM Outlook client will also perform better with high performance power settings. With powercfg (https://technet.microsoft.com/en-us/library/cc748940(v=ws.10).aspx) you can set certain values in this script. Let’s say that for anyone installing CRM for Outlook, you want to increase the turn off hard disks when plugged in to 4 hours. This is doable with one line:
powercfg /change disk-timeout-ac 240
You can also setting additional powersettings if your company has a standard powerplan, by grabbing the correct guid through powercfg.
Note: another setting that is recommended is to turn on cached Exchange mode. However, we generally recommend setting this through group policy ahead of time instead of scripting it, since it could lead to unrelated Outlook issues.
We’ve already copied the service pack 1 (renamed to patch.exe) from earlier, so now let’s apply it, by first running an extract command, then running the executable.
::install service pack 1
::create patch folder for extraction
echo Extracting patch.
“patch.exe” /quiet /extract:patch
::install with passive switch
echo Applying patch.
“crmupdatewrapper.exe” /passive /quiet
Once again, we use the /quiet and /passive switches to prevent user interaction while applying this patch.
Now we go into the config path defined previously, and configure it with our config file that we created.
echo Configuring CRM organization.
“%config-path%\microsoft.crm.application.outlook.configwizard.exe” /q /i “%userprofile%\outlook-install-temp\crm.xml”
/q means run in quiet mode, and /I lets us specify the config file.
So everything should now be working. However, earlier we created a temporary folder and added a bunch of stuff to it, and we no longer need it. So let’s get rid of it.
::delete installation folder
echo Deleting temporary installation files.
rd /s /q outlook-install-temp
echo Installation and updates are complete.
echo Please restart Microsoft Outlook to finish the configuration.
And there you have it! If you were able to follow all of this, added all the files, created your script, and ran it successfully – great job! If you simply copied all the code here line by line and it works … even better! Just remember to send out the link to a smaller set of users first to catch any unforeseen problems before rolling it out to everyone.
For more Outlook related content, check out these blogs:
Business Applications communities