/// <summary> /// Obtient un objet <see cref="SecurityIdentifier"/> à partir d'un nom de compte. /// </summary> /// <param name="AccountName">Nom de compte.</param> /// <returns></returns> public static SecurityIdentifier GetSidFromAccountName(string AccountName) { NTAccount na = new NTAccount(AccountName); return (SecurityIdentifier)na.Translate(typeof(SecurityIdentifier)); }
Public Shared Function GetSidFromAccountName(ByVal AccountName As String) As SecurityIdentifier Dim na As New NTAccount(AccountName) Return DirectCast(na.Translate(GetType(SecurityIdentifier)), SecurityIdentifier) End Function