From be01e4fba045d4d434827ac9527afd8ee5f85053 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 2 Feb 2023 14:18:29 +0100 Subject: [PATCH] [platform] avoiding PS profile loading when executing Defender configuration commands (IDEA-311788) GitOrigin-RevId: 56d424a179500d2ba034556a3e0eee2f2366e645 --- .../src/com/intellij/diagnostic/WindowsDefenderChecker.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/diagnostic/WindowsDefenderChecker.java b/platform/platform-impl/src/com/intellij/diagnostic/WindowsDefenderChecker.java index 8c7cc6b04010..7211e7c9bd08 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/WindowsDefenderChecker.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/WindowsDefenderChecker.java @@ -175,7 +175,8 @@ public class WindowsDefenderChecker { return false; } - var command = new GeneralCommandLine(psh.getPath(), "-NonInteractive", "-Command", "(Get-AuthenticodeSignature '" + script + "').Status"); + var scriptlet = "(Get-AuthenticodeSignature '" + script + "').Status"; + var command = new GeneralCommandLine(psh.getPath(), "-NoProfile", "-NonInteractive", "-Command", scriptlet); var output = run(command); if (output.getExitCode() != 0 || !"Valid".equals(output.getStdout().trim())) { LOG.info("validation failed:\n[" + output.getExitCode() + "] " + command + "\noutput: " + output.getStdout().trim()); @@ -184,7 +185,7 @@ public class WindowsDefenderChecker { command = ExecUtil.sudoCommand( new GeneralCommandLine(Stream.concat( - Stream.of(psh.getPath(), "-ExecutionPolicy", "Bypass", "-NonInteractive", "-File", script.toString()), + Stream.of(psh.getPath(), "-ExecutionPolicy", "Bypass", "-NoProfile", "-NonInteractive", "-File", script.toString()), paths.stream().map(Path::toString) ).toList()), ""