/ 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.

Don't forget to add other folder of your mapped workspaces!

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"
Add-MpPreference -ExclusionProcess "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
Add-MpPreference -ExclusionProcess "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
Add-MpPreference -ExclusionProcess "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
Add-MpPreference -ExclusionProcess "C:\Program Files\dotnet\dotnet.exe"
# customize path for cloud maschines
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\xppc.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\xppfagen.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\xppbp.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\SysTestConsole.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\xppcAgent.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\SyncEngine.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\SCDPBundleInstall.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\reportsc.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\pgc.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\LabelC.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\AXUtil.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\AxReportVmRoleStartupTask.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\PackagesLocalDirectory\Bin\AdminUserProvisioning.exe"
Add-MpPreference -ExclusionProcess "C:\AOSService\webroot\bin\Batch.exe"
# add SQLServer
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"

# add other folders
Add-MpPreference -ExclusionPath "C:\AOSService\PackagesLocalDirectory"
Add-MpPreference -ExclusionPath "C:\AOSService\webroot"


# 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:\Windows\assembly"
Add-MpPreference -ExclusionPath "C:\Windows\Microsoft.NET"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\MSBuild"
Add-MpPreference -ExclusionPath "C:\Program Files\dotnet"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Microsoft SDKs"
Add-MpPreference -ExclusionPath "C:\Program Files\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 ""
Add-MpPreference -ExclusionPath "C:\ProgramData\Microsoft\VisualStudio\Packages"
Add-MpPreference -ExclusionPath "C:\Program Files (x86)\Microsoft SDKs\NuGetPackages"
Add-MpPreference -ExclusionPath "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files"
Add-MpPreference -ExclusionPath "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files"
Add-MpPreference -ExclusionPath "C:\Users\Administrator\AppData\Local\Microsoft\VisualStudio"
Add-MpPreference -ExclusionPath "C:\Users\Administrator\AppData\Local\Microsoft\WebsiteCache"
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!

[D365] DevBox performance enhancements
Share this

Subscribe to robsCode