System Tray Installation Guide
Many NSClient++ users have trouble with setting up the System Tray icon.
The first thing you should understand that in Windows there are two ways a service can add its icon to the System Tray:
- Using the SERVICE_INTERACTIVE_PROCESS flag. This is the "old" way and has been in use on Windows versions until and including XP.
- Using the client-server communication (or shared session). This works fine on Windows XP and newer versions. This also works (sort of) on Windows 2000 (but not NT) but in this case I would recommend using XP since the session handling changed in XP.
Using the SERVICE_INTERACTIVE_PROCESS flag
On the technical level a service has the "SERVICE_INTERACTIVE_PROCESS" flag which allows it to interact with the "desktop". So NSClient++ simply adds an icon to the desktop and sets the flag with a few lines of code inside the same process.
<<<Add a nice image here>>>
Using the client-server communication
Since the "old" way was so simple Microsoft had to go about changing it. In "modern" Windows there are several desktop sessions instead of just one. The System Tray icon from NSClient++ will end up in desktop session 0. And unfortunately the session 0 is not the one where the logged in user ends up, which is session 1 and above. This is all down to the "User switching" which was introduced when terminal server was integrated into Windows 2000.
To circumvent this we can simply launch a program in the logged in user's session and have it communicate with the service. This is done by triggering on the "user logged in" (or as it is called in the debug log "Got session change...") and if enabled (shared_session=1) launch a process into that user's session and hope that they will communicate with each other. The actual communication is done using a shared session (technically a bunch of shared semaphores and a bunch of shared memory areas).
<<<Add a nice image here>>>
BETA WARNING Now this will introduce a lot of challenges and problems and as of now it is more of a technical preview then a stable and mature thing I would enable in production.
Installation guide
On Windows NT4, 2000, XP
NSC.ini
[modules] SysTray.dll
Then run:
NSClient++ -noboot systray install
On Windows XP, 2003, Vista, Windows 7, etc.
NSC.ini
[settings] shared_session=1
And:
- Don't enable the SysTray.dll module.
- Don't run the above command for installing the systray module.








