Code.ps1
# MrNetTek
# eddiejackson.net
# 1/10/2022
# free for public use
# free to claim as your own
Clear-Host
# GLOBAL
# SET LOCAL MACHINE KEYS
cmd /c "reg add ""HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications"" /v DisableNotifications /t REG_DWORD /d 0 /f /reg:64"
cmd /c "reg add ""HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications"" /v DisableEnhancedNotifications /t REG_DWORD /d 0 /f /reg:64"
# AZURE LOGIC
$Folder = 'C:\Program Files\FSLogix'
if (Test-Path -Path $Folder) {
# AZURE VDI(AVD)
$regObj = [Microsoft.Win32.RegistryKey]::OpenBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, [Microsoft.Win32.RegistryView]::Registry64)
$subKey1 = $regObj.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI")
$SID = $subKey1.GetValue("SelectedUserSID")
} else {
# AZURE AD (AAD) & Desktops
$regObj = [Microsoft.Win32.RegistryKey]::OpenBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, [Microsoft.Win32.RegistryView]::Registry64)
$subKey1 = $regObj.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI")
$SID = $subKey1.GetValue("LastLoggedOnUserSID")
}
# CHECK SID - IF NO SID, EXIT
if ( $SID -eq "" )
{
exit
}
cmd /c "reg add ""HKEY_USERS\$SID\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.SecurityAndMaintenance"" /v Enabled /t REG_DWORD /d 1 /f /reg:64"
cmd /c "reg add ""HKEY_USERS\$SID\Software\Microsoft\Windows\CurrentVersion\PushNotifications"" /v ToastEnabled /t REG_DWORD /d 1 /f /reg:64"
cmd /c "reg add ""HKEY_USERS\$SID\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"" /v NoToastApplicationNotification /t REG_DWORD /d 0 /f /reg:64"
cmd /c "reg add ""HKEY_USERS\$SID\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"" /v TaskbarNoNotification /t REG_DWORD /d 0 /f /reg:64"
cmd /c "reg add ""HKEY_USERS\$SID\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Advanced"" /v EnableBalloonTips /t REG_DWORD /d 2 /f /reg:64"
cmd /c "reg add ""HKEY_USERS\$SID\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"" /v DisableNotificationCenter /t REG_DWORD /d 0 /f /reg:64"
Notes
gpupdate /force (user context)
Settings > Notifications & actions > Get notifications from apps and other senders