In .net, I can create a NTAccount using domain and username, and get it's SID.
But I cannot convert the SID back to NTAccount using translate function.
new SecurityIdentifier(stringSid).Translate(typeof(NTAccount)).ToString();
And this two way conversion code has no problem running on Domain Controller.
Maybe some configuration wrong?
SecurityIdentifier.Translate() method works only on domain accounts so perhaps your computer not attached to domain. To resolve local SIDs into account name you can use Win32 API function LookupAccountSid() look here for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With