How to Get a SecurityIdentifier (SID) from a Username in C#

I keep looking this up:
[Sourcecode language=”C#”]
var account = new NTAccount(“username”);
var sid = (SecurityIdentifier)account.Translate(typeof(SecurityIdentifier));
[/sourcecode]

References

Posted in C#

Leave a Reply

Your email address will not be published.