Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
add get task names with SID & onedrive tasks
Greedeks812dffbcf376
diff --git a/.Source/GTweak/Utilities/Controls/PathLocator.cs b/.Source/GTweak/Utilities/Controls/PathLocator.csindex ead5f3ab..25084431 100644--- a/.Source/GTweak/Utilities/Controls/PathLocator.cs+++ b/.Source/GTweak/Utilities/Controls/PathLocator.cs@@ -59,6 +59,8 @@ namespace GTweak.Utilities.Controlsinternal static readonly string BackupRightsAcl = Path.Combine(Folders.DefenderBackup, "BackupRights.acl");internal static readonly string WindowsOld = Path.Combine(Folders.SystemDrive, "Windows.old");++ internal static readonly string Tasks = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32", "Tasks");}internal static class Registrydiff --git a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs b/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.csindex 3bbcab73..350f3234 100644--- a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs+++ b/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs@@ -1,5 +1,8 @@-using GTweak.Utilities.Helpers;+using GTweak.Utilities.Controls;+using GTweak.Utilities.Helpers;using GTweak.Utilities.Storage;+using System;+using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;@@ -53,7 +56,7 @@ namespace GTweak.Utilities.Managers}- internal static void DeletingTask(params string[] tasklist)+ internal static void RemoveTasks(params string[] tasklist){Task.Run(delegate{@@ -66,5 +69,16 @@ namespace GTweak.Utilities.Managers}});}++ internal static string GetTaskFullPath(string partialName)+ {+ string[] files = Directory.GetFiles(PathLocator.Files.Tasks, "*", SearchOption.AllDirectories);+ string matchPath = files.FirstOrDefault(path => Path.GetFileName(path).IndexOf(partialName, StringComparison.OrdinalIgnoreCase) >= 0);++ if (!string.IsNullOrWhiteSpace(matchPath))+ return Path.GetFileName(matchPath);+ else+ return partialName;+ }}}diff --git a/.Source/GTweak/Utilities/Storage/TaskStorage.cs b/.Source/GTweak/Utilities/Storage/TaskStorage.csindex 003c9588..0cf8a85c 100644--- a/.Source/GTweak/Utilities/Storage/TaskStorage.cs+++ b/.Source/GTweak/Utilities/Storage/TaskStorage.cs@@ -1,4 +1,6 @@-namespace GTweak.Utilities.Storage+using GTweak.Utilities.Managers;++namespace GTweak.Utilities.Storage{internal class TaskStorage{@@ -60,14 +62,14 @@@"\Microsoft\Windows\Maps\MapsToastTask",@"\Microsoft\Windows\Maps\MapsUpdateTask" };- protected static readonly string oneDriveTask = @"\Microsoft\Windows\OneDrive\OneDrive Standalone Update Task";+ protected static readonly string[] oneDriveTask = {+ @"\Microsoft\Windows\OneDrive\OneDrive Standalone Update Task",+ $@"\{TaskSchedulerManager.GetTaskFullPath("OneDrive Startup")}" };protected static readonly string[] edgeTasks = {- @"\MicrosoftEdgeUpdateTaskMachineUA{EA17DF76-AE5F-45F8-8867-FE5E0DD06656}",- @"\MicrosoftEdgeUpdateTaskMachineCore{11EED34D-1A62-4BB7-9A2E-0D83ED6A609F}",- @"\MicrosoftEdgeUpdateTaskMachineCore*",- @"\MicrosoftEdgeUpdateTaskMachineUA*",- @"\MicrosoftEdgeUpdateTaskUser*" };+ $@"\{TaskSchedulerManager.GetTaskFullPath("MicrosoftEdgeUpdateTaskMachineUA")}",+ $@"\{TaskSchedulerManager.GetTaskFullPath("MicrosoftEdgeUpdateTaskMachineCore")}",+ $@"\{TaskSchedulerManager.GetTaskFullPath("MicrosoftEdgeUpdateTaskUser")}" };protected static readonly string[] memoryDiagTasks = {@"\Microsoft\Windows\MemoryDiagnostic\ProcessMemoryDiagnosticEvents",diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.csindex f6502397..a41ed2e3 100644--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs@@ -146,7 +146,7 @@ namespace GTweak.Utilities.Tweaksswitch (packageName){case "Maps":- DeletingTask(mapsTasks);+ RemoveTasks(mapsTasks);break;case "Widgets":RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Dsh", "AllowNewsAndInterests", 0, RegistryValueKind.DWord);@@ -211,7 +211,7 @@ namespace GTweak.Utilities.Tweaksforeach (string process in new string[] { "msedge.exe", "pwahelper.exe", "edgeupdate.exe", "edgeupdatem.exe", "msedgewebview2.exe", "MicrosoftEdgeUpdate.exe", "msedgewebviewhost.exe", "msedgeuserbroker.exe", "usocoreworker.exe", "RuntimeBroker.exe" })CommandExecutor.RunCommandAsTrustedInstaller($"/c taskkill /f /im {process} /t");- DeletingTask(edgeTasks);+ RemoveTasks(edgeTasks);CommandExecutor.RunCommandAsTrustedInstaller(@"/c rmdir /s /q %LocalAppData%\Microsoft\Edge");CommandExecutor.RunCommandAsTrustedInstaller(@"/c for /r ""%AppData%\Microsoft\Internet Explorer\Quick Launch"" %f in (*Edge*) do del ""%f""");