forked from ScoopInstaller/Scoop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiagnostic.ps1
29 lines (26 loc) · 1.21 KB
/
diagnostic.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<#
Diagnostic tests.
Return $true if the test passed, otherwise $false.
Use 'warn' to highlight the issue, and follow up with the recommended actions to rectify.
#>
function check_windows_defender($global) {
$defender = get-service -name WinDefend -errorAction SilentlyContinue
if($defender -and $defender.status) {
if($defender.status -eq [system.serviceprocess.servicecontrollerstatus]::running) {
$hasGetMpPreference = Get-Command get-mppreference -errorAction SilentlyContinue
if($hasGetMpPreference) {
$installPath = $scoopdir;
if($global) { $installPath = $globaldir; }
$exclusionPath = (Get-MpPreference).exclusionPath
if(!($exclusionPath -contains $installPath)) {
warn "Windows Defender may slow down or disrupt installs with realtime scanning."
write-host " Consider running:"
write-host " sudo Add-MpPreference -ExclusionPath '$installPath'"
write-host " (Requires 'sudo' command. Run 'scoop install sudo' if you don't have it.)"
return $false
}
}
}
}
return $true
}