title: Check if no user is currently logged on to Windows
body: <p>I'm writing a Windows Service application which listens for connections and performs certain tasks as instructed from a different application running on another computer on the network.</p>
  
  <p>One of the tasks ensures no user is currently logged on, locks the workstation, delete some files, and then restarts the system. I considered using <a href="https://stackoverflow.com/questions/132620/how-do-you-retrieve-a-list-of-logged-in-connected-users-in-c">this solution</a> to look through the list of running processes and check the user names, determining if no user is logged on by matchhing the user names against SYSTEM, NETWORK, etc. I realized I have PostgreSQL running which uses a user account named postgres so that wouldn't work. Checking if explorer.exe is running also wouldn't work because explorer sometmes crashes, or I sometimes end the process myself and restart it.</p>
  
  <p>What would be a good way of determining that NO user is logged on to a workstation using C#?</p>