title: How to get user account unique id (GUID) on Windows?
body: <p>I would like to obtain a unique identifier (GUID not SID) of Windows account which my application is currently running on. I tried with <code>GetUserNameEx</code> with <code>NameUniqueId</code> as format. It works well on some machines but fails with <code>ERROR_NONE_MAPPED</code> on others (which seems to be a known problem):</p>
  
  <p><a href="https://stackoverflow.com/questions/3686201/how-do-you-read-the-users-display-first-and-last-name-on-all-versions-of-wind">How do you read the user&#39;s display (first and last) name on all versions of Windows reliably?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/2990340/getting-the-full-name-of-the-current-user-returns-an-empty-string-c-c">Getting the full-name of the current user, returns an empty string (C#/C++)</a></p>
  
  <p>Above mentioned questions concentrate on user name but doesn't answer how to obtain user account GUID.</p>