Skip to content

Commit

Permalink
run mpcmdrun command if the exe exists
Browse files Browse the repository at this point in the history
prevents errors if disabling defender using '--force' on an already disabled environment. why? sometimes our defender package doesn't get removed when enabling Defender and reinstalling the package fixes it
  • Loading branch information
melo936 committed Dec 8, 2024
1 parent 770a89b commit bcd2dfa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions common/lib/src/services/security_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ class SecurityService implements SetupService {
await _shell.run(
'start /WAIT /MIN /B "" "%systemroot%\\System32\\gpupdate.exe" /Target:Computer /Force');

await _shell.run(
"PowerShell -EP Unrestricted -NonInteractive -NoLogo -NoP -C 'Start-Process -FilePath \"$_mpCmdRunString\" -ArgumentList \"-RemoveDefinitions -All\" -NoNewWindow -Wait'");
if (await File(_mpCmdRunString).exists()) {
await _shell.run(
"PowerShell -EP Unrestricted -NonInteractive -NoLogo -NoP -C 'Start-Process -FilePath \"$_mpCmdRunString\" -ArgumentList \"-RemoveDefinitions -All\" -NoNewWindow -Wait'");
}

await _shell.run(
'"$directoryExe\\MinSudo.exe" --NoLogo --TrustedInstaller reg add "HKLM\\SOFTWARE\\Microsoft\\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f');
Expand Down

0 comments on commit bcd2dfa

Please sign in to comment.