Les Snippets

Connexion

Obtient le nom d'un compte à partir de son SID

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 29/09/2009 13:52:25 et initié par Willi [Liste]
Vue : 1200
Catégorie(s) : Sécurité
Langages dispo pour ce code :
- C# 2.x, C# 3.x
- VB 2005, VB 2008



Langage : C# 2.x , C# 3.x
Date ajout : 29/09/2009
Posté par Willi [Liste]
/// <summary>
/// Donne le nom du compte à partir de son SID.
/// </summary>
/// <param name="data">Données SID.</param>
/// <returns></returns>
public static string GetAccountNameFromSid(byte[] data)
{
    SecurityIdentifier si = new SecurityIdentifier(data, 0);
    string szAccountName = si.Translate(typeof(NTAccount)).Value;
    return szAccountName;
}
Langage : VB 2005 , VB 2008
Date ajout : 12/10/2009
Posté par Willi [Liste]
Public Shared Function GetAccountNameFromSid(ByVal data As Byte()) As String

  Dim si As New SecurityIdentifier(data, 0)
  Dim szAccountName As String = si.Translate(GetType(NTAccount)).Value
  Return szAccountName 
End Function


Snippets en rapport avec : Account, Name sid