{"id":1137,"date":"2026-11-15T10:42:38","date_gmt":"2026-11-15T10:42:38","guid":{"rendered":"https:\/\/windows-vps.org\/blog\/?p=1137"},"modified":"2026-11-15T10:42:38","modified_gmt":"2026-11-15T10:42:38","slug":"iis-sql-defender-exclusions-perf-cost","status":"publish","type":"post","link":"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/","title":{"rendered":"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Every Windows Server running IIS and SQL Server eventually gets the same advice: add exclusions to Microsoft Defender. The advice is correct in direction and usually wrong in execution \u2014 most shops paste a list of paths from a blog post written for a different workload, never measure the before and after, and end up with a permanent security gap they cannot justify at the next audit. This article covers what is genuinely worth excluding, how to measure whether it helped, and where the trade-off actually sits.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Defender costs anything at all on a database host<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Defender scans on file open and on close, and it inspects process behaviour. That is cheap for a web server serving a thousand static files an hour and expensive for a system writing hundreds of small files per second. SQL Server does exactly that: data file writes, log writes, checkpoint activity, and tempdb churn all generate file-system events. IIS adds request logging and ASP.NET compilation output. Both patterns look, to a signature engine, like a program rapidly rewriting files \u2014 which is precisely the behaviour a scanner is designed to watch.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So the question is not &#8220;does Defender cost CPU&#8221; \u2014 it does \u2014 but &#8220;is the cost large enough to justify a permanent hole in your antivirus coverage&#8221;. That is a measurement question, and it has a measurable answer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Measure before you exclude anything<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Get a baseline with the current configuration. You need three numbers: total CPU time consumed by <code>MsMpEng.exe<\/code>, disk read and write volume attributable to scans, and the application&#8217;s own throughput or latency. Capture them over the same time window, at the same load, before and after any change.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># CPU time and working set of the scan engine, sampled every 5 seconds for 10 minutes\nGet-Counter \"\\Process(MsMpEng)\\% Processor Time\", \"\\Process(MsMpEng)\\Working Set - Private\" `\n  -SampleInterval 5 -MaxSamples 120 |\n  Export-Counter -Path C:\\perf\\defender_before.blg -Force\n\n# Which paths are generating the most scan events\nGet-WinEvent -LogName \"Microsoft-Windows-Windows Defender\/Operational\" -MaxEvents 5000 |\n  Where-Object Id -in 1116,1117 |\n  Group-Object { $_.Properties[5].Value } | Sort-Object Count -Descending | Select-Object -First 20\n\n# SQL Server: is IO actually a problem, or are you guessing?\nSELECT DB_NAME(database_id) AS db, file_id, io_stall_read_ms, io_stall_write_ms,\n       num_of_reads, num_of_writes\nFROM sys.dm_io_virtual_file_stats(NULL, NULL)\nORDER BY io_stall_write_ms DESC;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If <code>MsMpEng.exe<\/code> is using under 3% of a core on average and the SQL stall numbers are in the low milliseconds, exclusions are not your problem and you should stop here. Above roughly 10% sustained CPU, or with visible <code>io_stall<\/code> spikes that correlate with the Defender event log, exclusions are worth the trade-off.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is worth excluding<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Target<\/th><th>Why<\/th><th>Risk if excluded<\/th><\/tr><\/thead><tbody><tr><td>SQL data, log, and backup directories<\/td><td>Constant large sequential writes and reads; scanning them is pure overhead and adds latency to every checkpoint<\/td><td>Low for execution, moderate for malicious file storage in a backup share<\/td><\/tr><tr><td>tempdb files<\/td><td>Extreme write churn, transient by definition<\/td><td>Very low<\/td><\/tr><tr><td>IIS log directory<\/td><td>Append-only text files written per request<\/td><td>Very low<\/td><\/tr><tr><td>ASP.NET temp files (<code>Temporary ASP.NET Files<\/code>)<\/td><td>Compiler output regenerated constantly<\/td><td>Very low<\/td><\/tr><tr><td><code>w3wp.exe<\/code> and <code>sqlservr.exe<\/code> process objects<\/td><td>Removes per-process behavioural scanning<\/td><td>Moderate to high \u2014 this is where real payloads run<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The pattern to notice is that path exclusions are cheap and process exclusions are not. Excluding a directory full of SQL data files removes scanning from files that are never executed. Excluding <code>w3wp.exe<\/code> removes scanning from everything your web application does, which is exactly the surface an attacker targets after a web shell lands. Take the path exclusions; think hard about the process ones.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Path exclusions only \u2014 no process-level holes\nAdd-MpPreference -ExclusionPath \"D:\\SQL\\Data\",\"D:\\SQL\\Log\",\"D:\\SQL\\Backup\",\"C:\\inetpub\\logs\\LogFiles\"\nAdd-MpPreference -ExclusionPath \"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files\"\nAdd-MpPreference -ExclusionExtension \"ldf\",\"mdf\",\"ndf\",\"bak\",\"trn\"\n\n# Verify it took, and see what is actually configured\nGet-MpPreference | Select-Object -ExpandProperty ExclusionPath\nGet-MpComputerStatus | Select-Object RealTimeProtectionEnabled, AntivirusEnabled, AMEngineVersion<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Compensate for what you gave up<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Path exclusions mean a malicious file can sit in <code>D:\\SQL\\Backup<\/code> undetected. That is acceptable only if something else catches it. Three controls do most of the work: restrict who can write to the excluded directories (SYSTEM and the SQL service account, nobody else), keep attack surface reduction rules enabled on the server, and ensure the weekly full scan still covers everything you excluded from real-time scanning.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>ACLs first.<\/strong> An excluded directory writable by <code>Everyone<\/code> is an incident waiting to happen. Tighten it before you add the exclusion.<\/li><li><strong>Keep ASR rules on.<\/strong> Behaviour-based rules do not depend on file scanning and remain effective on excluded paths.<\/li><li><strong>Schedule a weekly full scan<\/strong> outside business hours so excluded areas still get periodic coverage.<\/li><li><strong>Document every exclusion<\/strong> with the reason and the date, in version control, next to the server build script.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Monitoring Defender without the CPU cost<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cloud-delivered protection and automatic sample submission improve detection but add outbound traffic and some latency on first-seen files. On a VPS with metered bandwidth, check the volume before enabling submission on every binary your build pipeline produces. For production database hosts, keep cloud protection on and submission on for detected items only; that gives you the intelligence benefit without uploading routine build artefacts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Schedule scans rather than letting them run at random. A quick scan daily and a full scan weekly, both outside your traffic peak, is easier to reason about than the defaults Windows picks. If you are provisioning a new host and want the security baseline set correctly from the first boot, the <a href=\"https:\/\/windows-vps.org\/\">Windows Server hosting plans here<\/a> ship with a clean image you can configure before it takes production traffic.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The trade-off, stated plainly<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Excluding SQL directories, tempdb, IIS logs, and ASP.NET compile output typically recovers a meaningful slice of scan CPU and reduces write latency on database hosts, at the cost of reduced real-time coverage in areas that should never contain executables. Excluding <code>w3wp.exe<\/code> or <code>sqlservr.exe<\/code> trades a larger hole for a smaller gain. Measure first, exclude paths not processes, tighten ACLs on anything you exclude, and review the list quarterly \u2014 the exclusions that made sense on last year&#8217;s workload may be pure risk this year.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Every Windows Server running IIS and SQL Server eventually gets the same advice: add exclusions to Microsoft Defender. The advice is correct in direction and usually wrong in execution \u2014 most shops paste a list of paths from a blog post written for a different workload, never measure the before and after, and end up &#8230; <a title=\"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost\" class=\"read-more\" href=\"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/\" aria-label=\"Read more about Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-1137","post","type-post","status-publish","format-standard","hentry","category-hosting-workflows"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost - Windows VPS Blog<\/title>\n<meta name=\"description\" content=\"Every Windows Server running IIS and SQL Server eventually gets the same advice: add exclusions to Microsoft Defender. The advice is correct in direction\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost\" \/>\n<meta property=\"og:description\" content=\"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost\" \/>\n<meta property=\"og:url\" content=\"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/\" \/>\n<meta property=\"og:site_name\" content=\"Windows VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-15T10:42:38+00:00\" \/>\n<meta name=\"author\" content=\"windows-vps\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@myxiechengxuan\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"windows-vps\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/\",\"url\":\"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/\",\"name\":\"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost - Windows VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/#website\"},\"datePublished\":\"2026-11-15T10:42:38+00:00\",\"author\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58\"},\"description\":\"Every Windows Server running IIS and SQL Server eventually gets the same advice: add exclusions to Microsoft Defender. The advice is correct in direction\",\"breadcrumb\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/windows-vps.org\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#website\",\"url\":\"https:\/\/windows-vps.org\/blog\/\",\"name\":\"Windows VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/windows-vps.org\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58\",\"name\":\"windows-vps\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g\",\"caption\":\"windows-vps\"},\"sameAs\":[\"https:\/\/windows-vps.org\/blog\",\"https:\/\/x.com\/myxiechengxuan\"],\"url\":\"https:\/\/windows-vps.org\/blog\/author\/myxiechengxuan\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost - Windows VPS Blog","description":"Every Windows Server running IIS and SQL Server eventually gets the same advice: add exclusions to Microsoft Defender. The advice is correct in direction","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/","og_locale":"en_US","og_type":"article","og_title":"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost","og_description":"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost","og_url":"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/","og_site_name":"Windows VPS Blog","article_published_time":"2026-11-15T10:42:38+00:00","author":"windows-vps","twitter_card":"summary_large_image","twitter_creator":"@myxiechengxuan","twitter_misc":{"Written by":"windows-vps","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/","url":"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/","name":"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost - Windows VPS Blog","isPartOf":{"@id":"https:\/\/windows-vps.org\/blog\/#website"},"datePublished":"2026-11-15T10:42:38+00:00","author":{"@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58"},"description":"Every Windows Server running IIS and SQL Server eventually gets the same advice: add exclusions to Microsoft Defender. The advice is correct in direction","breadcrumb":{"@id":"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/windows-vps.org\/blog\/iis-sql-defender-exclusions-perf-cost\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/windows-vps.org\/blog\/"},{"@type":"ListItem","position":2,"name":"Windows Defender Exclusions for IIS and SQL Server: Measuring the Performance Cost"}]},{"@type":"WebSite","@id":"https:\/\/windows-vps.org\/blog\/#website","url":"https:\/\/windows-vps.org\/blog\/","name":"Windows VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/windows-vps.org\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58","name":"windows-vps","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g","caption":"windows-vps"},"sameAs":["https:\/\/windows-vps.org\/blog","https:\/\/x.com\/myxiechengxuan"],"url":"https:\/\/windows-vps.org\/blog\/author\/myxiechengxuan\/"}]}},"_links":{"self":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/1137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/comments?post=1137"}],"version-history":[{"count":1,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/1137\/revisions"}],"predecessor-version":[{"id":1140,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/1137\/revisions\/1140"}],"wp:attachment":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/media?parent=1137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/categories?post=1137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/tags?post=1137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}