I have a program X that I start, in Windows 10 pro, via task scheduler when the operating system starts
So the program starts and runs before any user has logged in
Then it can happen that an operator arrives and performs the user login on his desktop and starts working
How to use internal code in the X program to recognize the fact that a user has logged in?
I see many similar questions, however I want to find the Username of the currently logged in user using Java. Its probably something like: System.getProperty(current.user); But, I'm not quite sure.
Note: System.getProperty("user.name") will only work if the user launches the application. If the program is run by System or an application like LANDesk, then the user will come out as "SYSTEM" (under domain "NT AUTHORITY").