How to view and monitor the msDS-KeyVersionNumber attribute in Active Directory

Last updated on:

The msDS-KeyVersionNumber attribute stores the Kerberos Key Version Number (KVNO) for a user, computer, or built-in account in Active Directory (AD). It is a constructed attribute: AD computes its value automatically from the version counter on the account's unicodePwd attribute. The value increments by one each time the account's password changes, giving Kerberos clients and Key Distribution Centers (KDCs) a reliable way to detect stale session keys.

Because msDS-KeyVersionNumber is read-only, this article focuses on how to read and monitor it: using Active Directory Users and Computers (ADUC), PowerShell, and ManageEngine ADManager Plus.

msDS-KeyVersionNumber at a glance

LDAP display name msDS-KeyVersionNumber
CN ms-DS-KeyVersionNumber
Syntax Enumeration (Integer—attributeSyntax: 2.5.5.9, omSyntax: 2)
OM-Syntax 2
Attribute ID (OID) 1.2.840.113556.1.4.1782
System ID GUID c523e9c0-33b5-4ac8-8923-b57b927f42f6
Single- or multi-valued Single-valued
Indexed No
In Global Catalog No
Replicated No. Constructed locally on each DC; not replicated.
System-Only ( writable ) True—read-only. Cannot be set directly.
Constructed Yes. Computed from the dwVersion field of the unicodePwd AttributeStamp.
Visible in ADUC UI No. Requires the Attribute Editor tab.
Applies to Security-Principal class (users, computers, built-in accounts)
First implemented Windows Server 2003
Source schema Microsoft core AD schema
Microsoft reference Win32 ADSchema · MS-ADA2 · MS-ADTS computation spec

Note: msDS-KeyVersionNumber is a System-Only constructed attribute. Any attempt to write to it directly via ADSI Edit, Set-ADUser, or LDAP will fail with an error. The value is managed entirely by AD and increments automatically on each password change. The only supported way to indirectly influence the KVNO is to change the account's password.

What msDS-KeyVersionNumber is used for

msDS-KeyVersionNumber was introduced in Windows Server 2003 to give AD a monotonically increasing counter that tracks how many times a security principal's Kerberos keys have been rotated. Before Windows Server 2003, the key version number was derived from a timestamp rather than a counter, which made KVNO collisions possible in certain scenarios. The counter-based approach introduced in 2003 eliminated that ambiguity.

Every time an account's password changes in AD, the domain controller increments the version counter on the unicodePwd attribute. AD then exposes the current counter value as msDS-KeyVersionNumber. The Kerberos protocol uses this value so that a KDC can detect when a client is presenting a ticket encrypted with a key that has since been rotated, and reject it with a KRB_AP_ERR_MODIFIED or KRB_AP_ERR_BADKEYVER error.

Common scenarios where admins need to read msDS-KeyVersionNumber include:

  • Keytab file generation: The ktpass.exe tool uses msDS-KeyVersionNumber as the KVNO when generating a Kerberos keytab for a service account. The KVNO embedded in the keytab must match the current attribute value, or the keytab will be rejected. Any subsequent password change invalidates the keytab, making the current KVNO essential to track before and after generating one.
  • KRBTGT account rotation tracking: The krbtgt account's msDS-KeyVersionNumber tells you how many times the KRBTGT password has been changed in a domain. This is important for verifying Golden Ticket remediation (the KRBTGT password must be reset twice) and for auditing the KRBTGT rotation cadence.
  • Microsoft Entra Kerberos/Cloud Trust verification: The AzureADKerberos computer object used for Windows Hello for Business Cloud Trust exposes msDS-KeyVersionNumber. If the value is 0 or missing, the Kerberos key may not have been written correctly during provisioning.
  • Cross-realm Kerberos authentication troubleshooting: When Linux or Unix hosts authenticate against AD using keytabs, a KVNO mismatch between the keytab and the current AD value is one of the most common sources of kinit failures. Reading msDS-KeyVersionNumber is the first diagnostic step.
  • Service account life cycle auditing: Tracking how often service account passwords have changed helps enforce rotation policies and detect accounts that have never changed their password since creation.

Because msDS-KeyVersionNumber is constructed and not replicated, the value you read depends on which domain controller you query. Each DC computes the value locally. For the most current value, always query the PDC Emulator or the DC that processed the most recent password change.

  • ADUC
  • PowerShell
  • ADManager Plus
  • Troubleshooting
  • FAQ
 

How to view msDS-KeyVersionNumber using ADUC

View only: msDS-KeyVersionNumber is a constructed, System-Only attribute. The Attribute Editor displays the current computed value, but the field is not editable. Attempting to edit it will result in an "Access is denied" or "The attribute syntax specified to the directory service is invalid" error.

  1. Open Active Directory Users and Computers (dsa.msc).
  2. From the menu bar, select View > Advanced Features to unlock the Attribute Editor tab.
  3. Navigate to the user or computer object you want to inspect. Right-click and select Properties.
  4. Select the Attribute Editor tab. Scroll to msDS-KeyVersionNumber in the alphabetical list. The current KVNO is displayed in the Value column.

Note: If msDS-KeyVersionNumber does not appear in the Attribute Editor or shows as <not set>, Advanced Features may not be enabled, or you may be viewing the object on a read-only domain controller (RODC). Because the attribute is constructed and not replicated, it may not be visible on all DCs. Query the PDC Emulator or a full writable DC for a reliable reading.

Limitations of ADUC

  • One object at a time: ADUC has no facility for reading msDS-KeyVersionNumber across multiple accounts simultaneously. Bulk inspection requires PowerShell or a reporting tool.
  • No history: ADUC shows only the current value. It provides no record of when the KVNO last changed or how many times the password has been rotated.
  • DC-dependent: The Attribute Editor shows the value as computed by the DC you are currently connected to. For a definitive reading, connect explicitly to the PDC Emulator via Action > Change Domain Controller.
  • No alerting: ADUC does not notify you when msDS-KeyVersionNumber changes. Detecting KVNO changes for audit or keytab-maintenance purposes requires a separate monitoring solution.

How to read msDS-KeyVersionNumber using PowerShell

Because msDS-KeyVersionNumber is a constructed attribute, it is not returned by default with Get-ADUser or Get-ADComputer. You must request it explicitly using the -Properties parameter. All read operations should be directed at the PDC Emulator or a specific writable DC to ensure the most current value.

Read the KVNO for a single user

Get-ADUser -Identity jsmith -Properties 'msDS-KeyVersionNumber' |
Select-Object Name, SamAccountName, 'msDS-KeyVersionNumber'

Returns the current KVNO for the specified user account. Use single quotes around the attribute name to handle the hyphen.

Read the KVNO and password last set together

Get-ADUser -Identity jsmith -Properties 'msDS-KeyVersionNumber', PasswordLastSet |
Select-Object Name, SamAccountName, PasswordLastSet, 'msDS-KeyVersionNumber'

Returns KVNO alongside the last password change date, useful for correlating key rotation with password history.

Read the KVNO for a computer account

Get-ADComputer -Identity WEB01 -Properties 'msDS-KeyVersionNumber' |
Select-Object Name, 'msDS-KeyVersionNumber'

Returns the KVNO for the specified computer account. Computer account passwords rotate automatically every 30 days by default, so the KVNO increments regularly.

Query against the PDC Emulator explicitly

$PDC = (Get-ADDomain).PDCEmulator
Get-ADUser -Identity jsmith -Properties 'msDS-KeyVersionNumber' `
-Server $PDC |
Select-Object Name, 'msDS-KeyVersionNumber'

Directs the query to the PDC Emulator to ensure the most current KVNO is returned, regardless of which DC your session defaults to.

Read the KRBTGT account KVNO

$PDC = (Get-ADDomainController -Discover -Service PrimaryDC).HostName
Get-ADUser -Identity krbtgt `
-Properties 'msDS-KeyVersionNumber', PasswordLastSet `
-Server $PDC |
Select-Object DistinguishedName, PasswordLastSet, 'msDS-KeyVersionNumber'

Returns the KRBTGT account's current KVNO and last password set date. The KVNO should be two or higher after a two-reset Golden Ticket remediation cycle.

Export KVNO for all service accounts to CSV

$PDC = (Get-ADDomain).PDCEmulator
Get-ADUser -Filter {ServicePrincipalName -like '*'} `
-Properties SamAccountName, 'msDS-KeyVersionNumber', PasswordLastSet, ServicePrincipalName `
-Server $PDC |
Select-Object Name, SamAccountName, PasswordLastSet, 'msDS-KeyVersionNumber',
@{N='SPNs'; E={ ($_.ServicePrincipalName) -join '; ' }} |
Export-Csv .\service-account-kvno-report.csv -NoTypeInformation

Finds all accounts with at least one SPN, retrieves the current KVNO for each, and exports a CSV for tracking which accounts need keytab regeneration after a password change.

Common PowerShell errors

  • Property returns empty or null. The attribute was not requested explicitly. Add -Properties 'msDS-KeyVersionNumber' to the cmdlet call. Note the single quotes: the hyphen in the attribute name requires them.
  • Value differs between domain controllers. Because the attribute is constructed and not replicated, each DC computes it independently. Always specify -Server $PDC for a canonical reading.
  • "An attempt was made to modify an object to include an attribute that is not legal for its class." You are attempting to write the attribute. msDS-KeyVersionNumber is read-only and cannot be set via Set-ADUser or any other mechanism.

Limitations of PowerShell

  • Read-only: There is no PowerShell path to write this attribute. It is controlled exclusively by the AD password change process.
  • Constructed, not replicated: Targeting different DCs may return different values. The PDC Emulator is the authoritative source.
  • No change history: PowerShell returns the current value only. To track KVNO history over time, combine with scheduled export scripts or use a dedicated audit solution.

How to monitor msDS-KeyVersionNumber using ADManager Plus

ADManager Plus can surface msDS-KeyVersionNumber through custom attribute reports, giving you a centralized view of KVNO values across users and service accounts without running individual PowerShell queries. Because the attribute is read-only, all ADManager Plus workflows for it are reporting and monitoring, not modification.

Add msDS-KeyVersionNumber as a custom attribute

  1. Log in to ADManager Plus.
  2. Navigate to Admin > Custom Settings > LDAP Attributes.
  3. Click + Add Attribute.
  4. Enter msDS-KeyVersionNumber in the LDAP Name field.
  5. Enter a display label such as Kerberos Key Version (KVNO) in the Display Name field.
  6. Select Integer as the Data Type.
  7. Under Associated Reports, map it to User reports so the attribute appears as a column in custom user reports.
  8. Click Add to save the configuration.
Adding msDS-KeyVersionNumber as a custom attribute in ADManager Plus.

Build a custom KVNO report

  1. Navigate to Reports > Custom Reports and click + New Custom Report.
  2. Select User as the object type.
  3. Add Kerberos Key Version (KVNO) as a column alongside sAMAccountName, Password Last Set, and Service Principal Names.
  4. Optionally filter to accounts with at least one SPN to narrow results to service accounts.
  5. Save and schedule the report for periodic delivery to your inbox.

Report on service accounts and KVNO

ADManager Plus prebuilt user reports include User Attribute Reports that can be customized to show msDS-KeyVersionNumber alongside pwdLastSet and SPN data. This is particularly useful for tracking which service account keytabs are at risk of becoming stale after a password rotation cycle.

  1. Navigate to Reports > User Reports.
  2. Select All Users or a scoped OU-level report.
  3. Click Add or Remove Columns and add the Kerberos Key Version (KVNO) attribute you configured above.
  4. Export the report to CSV or schedule automated email delivery.
Generating a report to view msDS-KeyVersionNumber in ADManager Plus.

Delegate KVNO visibility to non-admins

To allow a help desk operator or security analyst to view KVNO data for service accounts without granting broader AD read rights, use help desk delegation:

  1. Navigate to Delegation > Help Desk Roles and click + Create New Role.
  2. Enter a Role Name and Description.
  3. Under User Attribute Privileges, grant read access to msDS-KeyVersionNumber and associated reporting actions.
  4. Save the role and assign it to the relevant operator, scoped to the service account OU.

Security and access considerations

By default, msDS-KeyVersionNumber is readable by all authenticated users in the domain, consistent with the general AD principle that non-sensitive attributes on user and computer objects are world-readable to domain members. The KVNO itself is not a secret: it is embedded in Kerberos tickets and transmitted in the clear as part of the AP-REQ structure. Knowing a principal's KVNO gives an attacker no cryptographic advantage.

  • No write path exists: Because the attribute is System-Only and constructed, there is no supported mechanism to set or forge it. The only way to influence the KVNO is to change the account's password, which requires the appropriate delegated or admin rights.
  • KRBTGT KVNO and Golden Ticket remediation: A low KVNO on the krbtgt account on an older domain may indicate the KRBTGT password has rarely or never been rotated. After a suspected Golden Ticket compromise, the KRBTGT password must be reset twice, on separate occasions at least 10 hours apart, to invalidate all outstanding forged TGTs. Confirm both resets by verifying the KVNO increments by two from its pre-incident value.
  • Keytab security: A keytab file generated with ktpass contains the Kerberos long-term key for the account at the time of generation, indexed by KVNO. Keytab files should be treated with the same sensitivity as the account's password. Rotating the account password invalidates the keytab (the KVNO increments, making the embedded key stale), which is the expected revocation mechanism.
  • Auditing password changes via KVNO: Because each password change increments msDS-KeyVersionNumber by one, comparing current KVNO values to a baseline snapshot is a lightweight way to detect unexpected password changes on sensitive accounts such as krbtgt or privileged service accounts. Track KVNO alongside pwdLastSet for a more complete picture.

Troubleshooting

  1. msDS-KeyVersionNumber does not appear in the Attribute Editor.

    Confirm that Advanced Features is enabled in ADUC (View > Advanced Features). If Advanced Features is already on and the attribute still does not appear, you may be connected to a read-only domain controller (RODC) or a pre-2003 DC. The attribute was introduced in Windows Server 2003 and is not present on older DCs. Reconnect to a full writable DC or the PDC Emulator.

  2. Get-ADUser returns an empty value for msDS-KeyVersionNumber.

    The attribute must be requested explicitly. Confirm your command includes -Properties 'msDS-KeyVersionNumber' with single quotes around the attribute name. If the value is still empty, confirm you are querying a writable DC with -Server $PDC. If the account was created without an initial password, for example, if some scripted or provisioning flows leave unicodePwd unset until the first password change, the attribute may return empty until a password is set.

  3. Keytab authentication fails with KRB5KRB_AP_ERR_MODIFIED or KVNO mismatch after a password change.

    The keytab was generated before the most recent password change and now contains a stale KVNO. Read the current msDS-KeyVersionNumber value from the PDC Emulator and regenerate the keytab using ktpass with the updated account credentials. The KVNO parameter passed to ktpass must match the value you read from AD.

  4. The KVNO differs between two domain controllers.

    msDS-KeyVersionNumber is a constructed attribute and is not replicated between DCs. Each DC computes the value independently from the local copy of the unicodePwd AttributeStamp. If AD replication is healthy, all DCs will converge to the same value after the password change replicates. If the values diverge and replication is healthy, check for USN rollback or lingering objects on the DC showing the lower value.

  5. The KRBTGT KVNO is unexpectedly large (for example, 200003).

    This is expected behavior when a domain is upgraded from a 2003 functional level to 2008 or later. In domains that were originally created at the Windows 2000 functional level, the KVNO was derived from a timestamp rather than a simple counter, resulting in values in the tens of thousands or higher. After upgrading to Windows Server 2003 or later, subsequent password changes increment the counter normally from that large baseline. The large value is not harmful.

  6. An attempt to set msDS-KeyVersionNumber via Set-ADUser fails with an attribute error.

    msDS-KeyVersionNumber is System-Only and cannot be written directly. The error is expected. To increment the KVNO, change the account's password using Set-ADAccountPassword or through ADUC. There is no supported way to set the KVNO to an arbitrary value.

Related attributes

  • msDS-SupportedEncryptionTypes: Specifies which Kerberos encryption types the account supports (RC4, AES128, AES256, DES). Works together with msDS-KeyVersionNumber to define the complete Kerberos key material for the account.
  • servicePrincipalName: Lists the Kerberos service principal names registered to the account. Accounts with SPNs are typically the ones for which keytabs are generated, making msDS-KeyVersionNumber directly relevant to their management.
  • pwdLastSet: Records when the account's password was last changed. Combined with msDS-KeyVersionNumber, it provides a complete picture of the account's key rotation history.
  • sIDHistory: Stores previous SIDs retained during domain migrations. Like msDS-KeyVersionNumber, it is part of the Kerberos and encryption cluster and matters for cross-domain authentication scenarios.
  • userAccountControl: Contains flags that affect Kerberos behavior, including DONT_REQUIRE_PREAUTH and USE_DES_KEY_ONLY, which interact with the encryption types negotiated using the current KVNO.

Monitor msDS-KeyVersionNumber and every AD attribute from one console

ADManager Plus gives you centralized visibility into Kerberos key versions, service account password rotation, and KRBTGT health, without requiring Domain Admin rights for every audit task. You can view msDS-KeyVersionNumber values, build custom KVNO reports, and delegate read access to security analysts, all from a single console.

Frequently asked questions

The integer value is a monotonically increasing counter representing how many times the account's Kerberos keys have been updated. A value of one typically means the password has been set once since the account was created or since the domain was upgraded to Windows Server 2003. Higher values reflect additional password changes over the account's lifetime.

No. There is no supported mechanism to reset the KVNO counter. The value increments monotonically and cannot be decremented or reset via any AD management tool. In practice, there is no operational reason to reset it: the Kerberos protocol only requires that the KVNO in a client's keytab or ticket matches the current value in AD.

Yes. Computer accounts reset their passwords automatically every 30 days by default (configurable via Group Policy). Each automatic machine password change increments the computer's msDS-KeyVersionNumber. This is normal behavior and does not require any administrator action.

No. The attribute is not replicated to the Global Catalog, and it is not replicated between domain controllers at all. It is constructed locally in each DC. For this reason, always target the PDC Emulator or the specific DC that processed the most recent password change when reading the value.

msDS-KeyVersionNumber is an on-premises AD DS constructed attribute and is not part of the Microsoft Entra Connect synchronization attribute set. Kerberos key versioning in Entra ID is managed separately through the Entra Kerberos infrastructure (used for Windows Hello for Business and Entra Kerberos Cloud Trust).

Yes, when the values match they refer to the same integer. The kvno field embedded in a keytab file generated by ktpass is taken directly from msDS-KeyVersionNumber at the time the keytab was created. Subsequent password changes increment the AD attribute, leaving the keytab's embedded kvno stale. Authentication fails until a new keytab is generated with the updated KVNO.

Manage msDS-KeyVersionNumber and any AD attribute at scale with ADManager Plus

The one-stop solution to Active Directory Management and Reporting
Email Download Link Email the ADManager Plus download link