title: How to get user login status for windows 10 vm in azure
body: <p>My use-case is the following:</p>
  
  <ul>
  <li>A "master" VHD in an Azure blob storage is copied</li>
  <li>A VM is created in Azure based on said copy of the VHD</li>
  <li>A user is provisioned locally in the VM</li>
  <li>The corresponding RDP file is handed out to a user</li>
  <li>The user can do whatever he wants (within his permissions) until the end of the day or he shuts down the VM</li>
  </ul>
  
  <p>I now want to programmatically check the status of the VM, i.e. if it's shut down, idle (running but no user logged in) or in use (user is currently logged in) from a web app. Only one user will have access to the VM and the windows-user only exists locally in the VM (might be a AD user in the future).</p>
  
  <p>I have full control over the azure subscription, in a future scenario I might also have access to the "parent" CSP subscription.</p>
  
  <p>For now I can determine whether the Vm is on or off. Is there some way to query the log-in status externally? My backup plan would be to include a service in the windows VHD to make these information available.</p>