From 08331fa4c75c93322f455bf74d8a3bcde136a465 Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Sun, 6 Oct 2024 20:25:52 +0100 Subject: [PATCH] fix: disable notifs for deployment --- src/playbook/Configuration/custom.yml | 2 +- .../tweaks/misc/enable-notifications.yml | 3 +- src/playbook/Executables/DISABLENOTIFS.cmd | 35 +++++++++++++++++++ src/playbook/Executables/ENABLENOTIFS.cmd | 24 +++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 src/playbook/Executables/DISABLENOTIFS.cmd create mode 100644 src/playbook/Executables/ENABLENOTIFS.cmd diff --git a/src/playbook/Configuration/custom.yml b/src/playbook/Configuration/custom.yml index 752c1a3a3e..d919bc1354 100644 --- a/src/playbook/Configuration/custom.yml +++ b/src/playbook/Configuration/custom.yml @@ -48,7 +48,7 @@ actions: # Prevent annoying notifications during deployment - !taskKill: {name: 'explorer'} - !cmd: - command: '"AtlasDesktop\6. Advanced Configuration\Services\Notifications\Disable Notifications.cmd" /includeuserservice' + command: 'DISABLENOTIFS.cmd' exeDir: true wait: true runas: currentUserElevated diff --git a/src/playbook/Configuration/tweaks/misc/enable-notifications.yml b/src/playbook/Configuration/tweaks/misc/enable-notifications.yml index 3885aedeed..c13372466b 100644 --- a/src/playbook/Configuration/tweaks/misc/enable-notifications.yml +++ b/src/playbook/Configuration/tweaks/misc/enable-notifications.yml @@ -3,6 +3,7 @@ title: Enable Notifications description: Notifications were turned off at the start of the Playbook to prevent random notifications from interfering with the process. This task re-enables notifications. actions: - !cmd: - command: '"AtlasDesktop\6. Advanced Configuration\Services\Notifications\Enable Notifications (default).cmd" /silent' + command: 'ENABLENOTIFS.cmd' exeDir: true wait: true + runas: currentUserElevated diff --git a/src/playbook/Executables/DISABLENOTIFS.cmd b/src/playbook/Executables/DISABLENOTIFS.cmd new file mode 100644 index 0000000000..6bf9f1f265 --- /dev/null +++ b/src/playbook/Executables/DISABLENOTIFS.cmd @@ -0,0 +1,35 @@ +@echo off + +:: Registry changes +reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userNotificationListener" /v "Value" /t REG_SZ /d "Deny" /f > nul +reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings" /v "NOC_GLOBAL_SETTING_ALLOW_NOTIFICATION_SOUND" /t REG_DWORD /d "0" /f > nul +reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" /v "ToastEnabled" /t REG_DWORD /d "0" /f > nul +reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" /v "NoCloudApplicationNotification" /t REG_DWORD /d "1" /f > nul + +:: Hide Settings pages +for %%a in ( + "notifications" + "privacy-notifications" +) do ( + call "%windir%\AtlasModules\Scripts\settingsPages.cmd" /hide %%~a /silent +) + +:: Disable notif center +reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v "DisableNotificationCenter" /t REG_DWORD /d "1" /f > nul + +:: Disable services +sc config WpnService start=disabled > nul +sc stop WpnService > nul 2>&1 +call "%windir%\AtlasModules\Scripts\setSvc.cmd" "WpnUserService" 4 +for /f "tokens=5 delims=\" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Services" ^| find "WpnUserService_"') do ( + call "%windir%\AtlasModules\Scripts\setSvc.cmd" "%%a" 4 + sc stop "%%a" > nul + sc delete "%%a" > nul +) + +:: Apply changes +taskkill /f /im explorer.exe > nul 2>&1 +taskkill /f /im ShellExperienceHost.exe > nul 2>&1 +start explorer.exe + +echo Disabled notifications. \ No newline at end of file diff --git a/src/playbook/Executables/ENABLENOTIFS.cmd b/src/playbook/Executables/ENABLENOTIFS.cmd new file mode 100644 index 0000000000..fef6891d07 --- /dev/null +++ b/src/playbook/Executables/ENABLENOTIFS.cmd @@ -0,0 +1,24 @@ +@echo off + +:: Revert Registry changes +reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v "DisableNotificationCenter" > nul +reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userNotificationListener" /v "Value" /t REG_SZ /d "Allow" /f > nul +reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings" /v "NOC_GLOBAL_SETTING_ALLOW_NOTIFICATION_SOUND" /t REG_DWORD /d "1" /f > nul +reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" /v "ToastEnabled" /t REG_DWORD /d "1" /f > nul +reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" /v "NoCloudApplicationNotification" /f > nul 2>&1 + +:: Unhide Settings pages +for %%a in ( + "notifications" + "privacy-notifications" +) do ( + call "%windir%\AtlasModules\Scripts\settingsPages.cmd" /unhide %%~a /silent +) + + +:: Apply changes +taskkill /f /im explorer.exe > nul 2>&1 +taskkill /f /im ShellExperienceHost.exe > nul 2>&1 +start explorer.exe + +echo Enabled notifications. \ No newline at end of file