Created
May 30, 2023 12:51
-
-
Save kierunb/d7e5ac50468c2355ff6cb927c50eda03 to your computer and use it in GitHub Desktop.
Windows Defender Exclusions for .NET/VS Developers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $userPath = $env:USERPROFILE | |
| $pathExclusions = New-Object System.Collections.ArrayList | |
| $processExclusions = New-Object System.Collections.ArrayList | |
| #$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null | |
| #$pathExclusions.Add($userPath + '\.dotnet') > $null | |
| #$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null | |
| # $pathExclusions.Add($userPath + '\AppData\Local\Programs\Microsoft VS Code') > $null | |
| # $pathExclusions.Add($userPath + '\AppData\Local\Programs\Azure Data Studio') > $null | |
| # $pathExclusions.Add($userPath + '\AppData\Local\Programs\Microsoft Azure Storage Explorer') > $null | |
| # $pathExclusions.Add($userPath + '\AppData\Local\Programs\Microsoft VS Code') > $null | |
| # $pathExclusions.Add($userPath + '\AppData\Roaming\Code') > $null | |
| # $pathExclusions.Add('C:\Program Files\Microsoft Office\') > $null | |
| $processExclusions.Add('azuredatastudio.exe') > $null | |
| $processExclusions.Add('StorageExplorer.exe') > $null | |
| $processExclusions.Add('Code.exe') > $null | |
| #$processExclusions.Add('sqlwriter.exe') > $null | |
| Write-Host "This script will create Windows Defender exclusions for common Developer Apps folders and processes." | |
| foreach ($exclusion in $pathExclusions) | |
| { | |
| Write-Host "Adding Path Exclusion: " $exclusion | |
| Add-MpPreference -ExclusionPath $exclusion | |
| } | |
| foreach ($exclusion in $processExclusions) | |
| { | |
| Write-Host "Adding Process Exclusion: " $exclusion | |
| Add-MpPreference -ExclusionProcess $exclusion | |
| } | |
| Write-Host "" | |
| Write-Host "Your Exclusions:" | |
| $prefs = Get-MpPreference | |
| $prefs.ExclusionPath | |
| $prefs.ExclusionProcess | |
| Write-Host "" | |
| Write-Host "Enjoy faster build times and coding!" | |
| Write-Host "" | |
| AppData\Local\Programs\Microsoft VS Code\Code.exe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment