Skip to content

Commit

Permalink
fix: disable notifs for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Oct 6, 2024
1 parent 7447624 commit 08331fa
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/playbook/Configuration/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 35 additions & 0 deletions src/playbook/Executables/DISABLENOTIFS.cmd
Original file line number Diff line number Diff line change
@@ -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.
24 changes: 24 additions & 0 deletions src/playbook/Executables/ENABLENOTIFS.cmd
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 08331fa

Please sign in to comment.