Skip to content

AD Attributes

sAMAccountName — the pre-Windows 2000 logon name

sAMAccountName is the short, unique logon name of a security principal in a domain. It predates the UPN, is capped at 20 characters, and appears in nearly every authentication event.

What it is

sAMAccountName is the pre-Windows 2000 logon name of a user, computer or group — the jsmith in CONTOSO\jsmith. It predates the userPrincipalName (jsmith@contoso.com) and is still what most of Windows authenticates with under the hood.

The value is unique within a domain and indexed, which is why logons and lookups against it are fast. For computer accounts it ends in a $ (DC01$). It is a single-valued, Unicode string attribute.

Constraints

  • Maximum 20 characters (a hard limit that still bites when generating accounts programmatically).
  • Must be unique in the domain; the system enforces it.
  • Certain characters are disallowed (" / \ [ ] : ; | = , + * ? < > and leading/trailing spaces).

Where you see it

Almost every security event: logon events (4624/4625) carry it as the Account Name, Kerberos tickets reference it, and it is the handle you search on in PowerShell:

Get-ADUser -Filter "sAMAccountName -eq 'jsmith'" -Properties *
  • userPrincipalName — the modern, email-style logon name
  • objectSid — the account's SID
  • userAccountControl — the account's control flags