/ d365

# [D365] DevBox performance enhancements

After searching to enhance the performance of D365 DevBoxes I tried a lot of stuff. During the analysis one thing stood out clearly:

Windows Defender plays a huge role regarding the performance of Visual Studio, the IIS, Database Sync, Report Server and other parts of the D365 environment running on a OneBox environment!

## How does the Windows Defender affects the performance?

The Windows Defender is doing its work and scans files for malicious signatures in the background. It also has a feature to scan running programs.

When running a compile from Visual Studio, synchronizing the database or simply having a batchjob in the background, Windows Defender is on it to scan it!

While this behavior is not bad by design, it has an impact on the performance, especially with tasks that require a lot of resources from the system.

## What to expect from the following changes

Please be aware that the following changes will not supercharge your DevBox!

To set the expectations right, this will improve the performance noticably for some tasks, but this is not a workaround for having good hardware.

## Now, what to change

Below is a PowerShell script to add Windows Defender exclusion rules for all the executable files of tools used for D365 development and running it.

There are also certain paths from the filesystem excluded, like the PackagesLocalDirectory folder.

I researched those changes with the help of the Debugging Tools for Windows in combination with the knowledge of how stuff works around that.

# visual studio & tools
Add-MpPreference -ExclusionProcess "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
Add-MpPreference -ExclusionProcess "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe"
Add-MpPreference -ExclusionProcess "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
# customize path for cloud maschines
Add-MpPreference -ExclusionProcess "C:\Program Files\Microsoft SQL Server\130\LocalDB\Binn\sqlservr.exe"
Add-MpPreference -ExclusionProcess "C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Binn\sqlservr.exe"

# cache folders

Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Microsoft Visual Studio 10.0"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Microsoft Visual Studio"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Microsoft SDKs"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Microsoft Office"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Microsoft SDKs\NuGetPackages"
Add-MpPreference -ExclusionPath "C:\Users\Administrator\AppData\Roaming\Microsoft\VisualStudio"

## Save some time - automated way

As I am a huge fan of the d365fo-tools project which provides PowerShell modules for all kinds of tasks, I saw the perfect opportunity to contribute and so I did.

You can install this module and use the command Add-D365WindowsDefenderRules to make the above described changes with just one single command!

#### Robin

[D365] DevBox performance enhancements