API Reference
SidResolver
Provides helper methods for resolving SIDs and distinguished names.
Inheritance
- Object
- SidResolver
Methods
public static String AccountNameToSidString(String accountName) #StringResolves an account name (SAM, UPN or distinguished name) to a SID string.
Parameters
- accountName System.String
- Account identity such as DOMAIN\\Name, Name@domain, or a DN.
Returns
SID string when resolution succeeds; otherwise null.
public static SecurityIdentifier DistinguishedNameToSid(String distinguishedName) #SecurityIdentifierConverts a distinguished name to a SecurityIdentifier.
Parameters
- distinguishedName System.String
- Object distinguished name.
Returns
SID or null when not found.
public static String DistinguishedNameToSidString(String distinguishedName) #StringConverts a distinguished name to a SID string.
Parameters
- distinguishedName System.String
- Object distinguished name.
public static IdentityType GetIdentityType(SecurityIdentifier sid) #IdentityTypeDetermines the directory object type for the specified SID.
Parameters
- sid System.Security.Principal.SecurityIdentifier
- SID value.
Returns
Resolved identity type.
public static IdentityType GetIdentityType(String sid) #IdentityTypeDetermines the directory object type for the specified SID string.
Parameters
- sid System.String
- SID string.
Returns
Resolved identity type.
public static ValueTuple<Int32, Int32, TimeSpan> GetSidDnCacheStats() #ValueTuple<Int32, Int32, TimeSpan>Returns simple stats for the SID→DN cache (count, limit, TTL).
public static String SidToAccountName(SecurityIdentifier sid) #StringTranslates a SID to an NT account name.
Parameters
- sid System.String
- SID string.
Returns
Account name or null when translation fails.
SidToAccountName(System.Security.Principal.SecurityIdentifier sid) #Translates a SID to an NT account name.
Parameters
- sid System.Security.Principal.SecurityIdentifier
- SID value.
public static String SidToDistinguishedName(SecurityIdentifier sid) #StringConverts a SID to a distinguished name.
Parameters
- sid System.String
- SID string.
Returns
Distinguished name or null when not found.
public static String SidToDistinguishedName(String sid, String domainName) #StringAttempts to resolve a SID to a DN using a healthy DC from the provided domain. Uses the bounded LDAP engine path instead of a serverless ADSI bind to avoid hanging on half‑dead controllers.
Parameters
- sid System.String
- SID string.
- domainName System.String
- DNS domain to target. When null, falls back to serverless bind.
Returns
Distinguished name or null if not found.
SidToDistinguishedName(System.Security.Principal.SecurityIdentifier sid) #Converts a SID to a distinguished name.
Parameters
- sid System.Security.Principal.SecurityIdentifier
- SID value.