Skip to content

Portable Tool for an Ideal Windows Setup

add exclusions to Windows Defender

Greedeks49ec63d7a28a
diff --git a/.Source/GTweak/Utilities/Controls/RunGuard.cs b/.Source/GTweak/Utilities/Controls/RunGuard.cs
index 5cd658b8..e2f829ab 100644
--- a/.Source/GTweak/Utilities/Controls/RunGuard.cs
+++ b/.Source/GTweak/Utilities/Controls/RunGuard.cs
@@ -6,6 +6,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Helpers;
using GTweak.Windows;
namespace GTweak.Utilities.Controls
@@ -57,5 +58,7 @@ namespace GTweak.Utilities.Controls
new MessageWindow(true).ShowDialog();
}
+
+ internal static void CheckingDefenderExclusions() => CommandExecutor.RunCommandAsTrustedInstaller($@"$ErrorActionPreference = 'Stop'; $target = '{SettingsEngine.currentLocation}'; try {{ $mp = Get-MpPreference; if ($mp.ExclusionProcess -notcontains $target) {{ Add-MpPreference -ExclusionProcess $target }}; if ($mp.ExclusionPath -notcontains $target) {{ Add-MpPreference -ExclusionPath $target }} }} catch {{}}", true);
}
}
diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
index 0d1476ee..a63085ce 100644
--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs
+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
@@ -65,6 +65,7 @@ namespace GTweak.Windows
ExecuteWithLogging(() => HardwareData.RunningServicesCount = _systemDiagnostics.GetServicesCount().GetAwaiter().GetResult(), nameof(_systemDiagnostics.GetServicesCount));
ExecuteWithLogging(() => _systemDiagnostics.GetTotalProcessorUsage().GetAwaiter().GetResult(), nameof(_systemDiagnostics.GetTotalProcessorUsage));
ExecuteWithLogging(() => _systemDiagnostics.GetPhysicalAvailableMemory().GetAwaiter().GetResult(), nameof(_systemDiagnostics.GetPhysicalAvailableMemory));
+ ExecuteWithLogging(RunGuard.CheckingDefenderExclusions, nameof(RunGuard.CheckingDefenderExclusions));
}
private void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index dd9d163b..1e643405 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -9,7 +9,6 @@ using System.Windows.Threading;
using GTweak.Utilities.Animation;
using GTweak.Utilities.Configuration;
using GTweak.Utilities.Controls;
-using GTweak.Utilities.Managers;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -25,9 +24,6 @@ namespace GTweak.Windows
{
InitializeComponent();
App.TweaksImported += delegate { BtnUtils.IsChecked = true; };
-
- ArchiveManager.Unarchive(PathLocator.Executable.NSudo, Properties.Resources.NSudoLC);
- ArchiveManager.Unarchive(PathLocator.Executable.DisablingWD, Properties.Resources.DisablingWD);
}
private void AnimateSettings()