How can I convert from a SID to an account name in C#
I have a C# application that scans a directory and gathers some information. I would like to display the account name for each file. I can do this on the local system by getting the SID for the FileInfo object, and then doing: string GetNameFromSID( SecurityIdentifier sid ) { NTAccount ntAccount = (NTAccount)sid.Translate( typeof( NTAccount ) ); return ntAccount.ToString(); } However, this does not work for files on a network, presumably because the Translate() function only works with local user accounts. I thought maybe I could do an LDAP lookup on the SID, so I tried the following: string