As per the documentation for GetComputerNameEx "The names are established at system startup, when the system reads them from the registry." Therefore the name is the same regardless of whether the user logged in using a WindowsAccount, local account or normal Domain account.

I have tried the function nevertheless (with all the 8 options for "Name Type") and it would either return the computer name, domain name or combination of computer and domain name.

Obviously what I need is possible because Sysinternals is able to provide this information with BGInfo. I have not seen anyone else able to do it.

Any other ideas?