try this AHK script:
Clear SysTray History.
- clears the specified the reg key when shutting down.
- code for detecting shut-down based on haichen's
script.
;Clear SysTray History script
;Code for Shut-down query based on haichen's script
;Run before shutdown - http://www.autohotkey.com/forum/viewtopic.php?t=26304
#Persistent
#SingleInstance force
#NoTrayIcon
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
DetectHiddenWindows On
DllCall("kernel32.dll\SetProcessShutdownParameters", UInt, 0x4FF, UInt, 0)
OnMessage(0x11, "WM_QUERYENDSESSION")
Return
WM_QUERYENDSESSION(wParam, lParam)
{
;RegDelete, RootKey, SubKey [, ValueName]
RegDelete, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify, IconStreams
RegDelete, HKCU, Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify, PastIconsStream
ExitApp
}