Skip to content

Commit 5e8f083

Browse files
committed
Make Microsoft-Defender status read more robust
Fixes #1758
1 parent ebac853 commit 5e8f083

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowsDefenderConfigurator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Arrays;
2525
import java.util.Base64;
2626
import java.util.List;
27+
import java.util.Locale;
2728
import java.util.Optional;
2829
import java.util.concurrent.ExecutionException;
2930
import java.util.concurrent.ExecutorService;
@@ -308,11 +309,11 @@ private static boolean isWindowsDefenderActive(IProgressMonitor monitor) throws
308309
try {
309310
List<String> lines = runPowershell(monitor, "-Command", "(Get-MpComputerStatus).AMRunningMode"); //$NON-NLS-1$ //$NON-NLS-2$
310311
String onlyLine = lines.size() == 1 ? lines.get(0) : ""; //$NON-NLS-1$
311-
return switch (onlyLine) {
312+
return switch (onlyLine.toLowerCase(Locale.ENGLISH)) {
312313
// Known values as listed in
313314
// https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/microsoft-defender-antivirus-windows#use-powershell-to-check-the-status-of-microsoft-defender-antivirus
314-
case "SxS Passive Mode", "Passive mode" -> false; //$NON-NLS-1$ //$NON-NLS-2$
315-
case "Normal", "EDR Block Mode" -> true; //$NON-NLS-1$//$NON-NLS-2$
315+
case "sxs passive mode", "passive mode" -> false; //$NON-NLS-1$ //$NON-NLS-2$
316+
case "normal", "edr block mode" -> true; //$NON-NLS-1$//$NON-NLS-2$
316317
default -> throw new IOException("Process terminated with unexpected result:\n" + String.join("\n", lines)); //$NON-NLS-1$//$NON-NLS-2$
317318
};
318319
} catch (IOException e) {

0 commit comments

Comments
 (0)