Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <# :: Windows Update Notifications-only Toggle, AveYo 2018-2022
- @set "0=%~f0" &set 1=%*& powershell -nop -c iex ([io.file]::ReadAllText($env:0)) & exit /b
- #>
- $PS = {
- $notify=@()
- $notify += 'MusNotification','MusNotifyIcon','MoNotificationUx' # UpdateOrchestrator
- $notify += 'EOSNotify','GWX' # End Of Support
- $notify += 'UpdateNotificationMgr','UNPUXLauncher','UNPUXHost' # Universal Notification Platform
- ## OPTIONAL: # OPTIONAL:
- #$notify += 'wermgr','WerFault','WerFaultSecure','DWWIN' # Windows Error Reporting
- #$notify += 'compattelrunner' # Application Experience
- #$notify += 'dstokenclean','appidtel' # ApplicationData
- #$notify += 'wsqmcons' # Customer Experience Improvement Prg
- #$notify += 'dusmtask' # DUSM
- #$notify += 'dmclient' # Feedback\Siuf
- #$notify += 'DataUsageLiveTileTask' # {SID}\DataSenseLiveTileTask
- #$notify += 'DiagnosticsHub.StandardCollector.Service' # System32\DiagSvcs
- #$notify += 'HxTsr' # microsoft.windowscommunicationsapps
- #$notify += 'PilotshubApp' # Microsoft.WindowsFeedbackHub_
- #$notify += 'SpeechModelDownload','SpeechRuntime' # Speech
- #$notify += 'LocationNotificationWindows','WindowsActionDialog' # Location
- $ifeo='HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options'
- if (gp "$ifeo\GWX.exe" Debugger -ea 0) {$TOGGLE=7;$KEEP=6;$A='Restore';$S='OFF'}else{$TOGGLE=6;$KEEP=7;$A='Disable';$S='ON'}
- $dummy="$env:SystemRoot\System32\systray.exe"
- ## Comment to hide dialog prompt with Yes, No, Cancel (6,7,2)
- if ($env:1 -ne 6 -and $env:1 -ne 7) {
- $choice=(new-object -ComObject Wscript.Shell).Popup("$A Windows Update Notifications?", 0, "WU Notifications: $S", 0x1033)
- if ($choice -eq 2) {return} elseif ($choice -eq 6) {$env:1=$TOGGLE; $1=$env:1} else {$env:1=$KEEP; $1=$env:1}
- }
- ## Without the dialog prompt above will toggle automatically
- if ($env:1 -ne 6 -and $env:1 -ne 7) { $env:1=$TOGGLE }
- ## Elevate passing $choice as $env:1
- $admin = fltmc; if ($LASTEXITCODE) {
- $i="`r (\ /)`r( * . * ) UAC is useless below Always-Notify`r ```r"
- start -verb runas -win 1 powershell -args "-nop -c & {`$i='$i'; `$env:1=$1; `$PS={$($PS -replace'"','\"')}; & `$PS}"; return
- }
- ## Undo upgrade entries in previous script versions since that goes above just notifications *facepalm*
- 'Windows10UpgraderApp','Windows10Upgrade','WindowsUpdateBox' |% {
- if (gp "$ifeo\$_.exe" Debugger -ea 0) {ri "$ifeo\$_.exe" -Force -ea 0}
- }
- ## Toggle
- if ($env:1 -eq 6) {
- $notify |% {
- kill -name $_ -force -ea 0
- ni "$ifeo\$_.exe" -Force -ea 0|out-null
- sp "$ifeo\$_.exe" Debugger $dummy -Force -ea 0
- }
- } else {
- $notify |% {ri "$ifeo\$_.exe" -Force -ea 0}
- }
- #timeout -1
- return
- }
- & $PS
- #-_-# hybrid script, can be pasted directly into powershell console
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement