I would like to obtain a unique identifier (GUID not SID) of Windows account which my application is currently running on. I tried with GetUserNameEx
with NameUniqueId
as format. It works well on some machines but fails with ERROR_NONE_MAPPED
on others (which seems to be a known problem):
How do you read the user's display (first and last) name on all versions of Windows reliably?
Getting the full-name of the current user, returns an empty string (C#/C++)
Above mentioned questions concentrate on user name but doesn't answer how to obtain user account GUID.