dsHeuristics behavior manipulation

Many aspects of ADs behavior are governed by the dsHeuristics attribute of the Directory Service configuration object:

CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=<rootNC>

In contrast to the far more elusive “DSA Heuristics” registry value, dsHeuristics is very well documented and is actively used to add new behaviors to AD. The attribute is a string, read from left to right, and each character may contain a hexadecimal digit. The meaning of these is as follows (the default behavior corresponds to a zero value, unless specified otherwise):

PositionParameterBehavior if nonzero
1fSupFirstLastANRAmbiguous Name Resolution will not include search by “Firstname Lastname”.
2fSupLastFirstANRAmbiguous Name Resolution will not include search by “Lastname Firstname”.
3fDoListObjectThe “List Object” right will be enforced and children will be hidden if the searcher does not have the DS_LIST_OBJECT right on the parent.
4fDoNickResAmbiguous Name Resolution request via MAPI will attempt an exact match against the MAPI nickname.
5fLDAPUsePermModLDAP will use the LDAP_SERVER_PERMISSIVE_MODIFY control (return success even if no modification is performed). Otherwise LDAP willuse strict modification behavior and return an error if no modifications are to be performed, like deleting an attribute that is not present.
6ulHideDSID0 = DSID will always be returned.
1 = DSID will only be returned if it does not reveal the identity of the object otherwise invisible to the client.
2-f = DSID will NOT be returned.
7fLDAPBlockAnonOps2 (default) = LDAP will only allow searching RootDSE anonymously, regardless of ACL.
other value = LDAP will allow anonymous searches if the ACLs permit them.
This parameter requires Server 2003 or newer to take effect.
8fAllowAnonNSPIAllow anonymous NSPI (RPC) calls.
9fUserPwdSupport0 or 2 = Allow access to userPassword attribute, ACLs permitting.
other value = Disable access to userPassword attribute, regardless of permissions.
10tenthCharMust be 1 if positions beyond 9 are to be set.
11fSpecifyGUIDOnAddOn adding an object, specifying its GUID is allowed.
12fDontStandardizeSDsThe order of ACEs supplied by the client is preserved, ordering rules are ignored.
13fAllowPasswordOperationsOverNonSecureConnectionPassword operations are allowed without encryption. This is only valid for ADLDS!
14fDontPropagateOnNoChangeUpdatentSecurityDescriptor is propagated to descendant objects on change, even if the new value is bitwise identical to the old one.
This parameter requires Server 2008 or newer to take effect.
15fComputeANRStatsANR searches are optimized using cardianlity estimates from previous searches.
16dwAdminSDExMaskExcludes operator groups from SDPROP:
1 = Account Operators
2 = Server Operators
3 = Account Operators + Server Operators
4 = Print Operators
5 = Account Operators + Print Operators
6 = Server Operators + Print Operators
7 = Account Operators + Server Operators + Print Operators
8 = Backup Operators
9 = Account Operators + Backup Operators
a = Server Operators + Backup Operators
b = Account Operators + Server Operators + Backup Operators
c = Print Operators + Backup Operators
d = Account Operators + Print Operators + Backup Operators
e = Server Operators + Print Operators + Backup Operators
f = Account Operators + Server Operators + Print Operators + Backup Operators
17fKVNOEmuW2KmsDS-KeyVersionNumber will always equal 1 (W2K emulation).
18fLDAPBypassUpperBoundsOnLimitsDCs will bypass implementation-dependent limits on LDAP policies.
This parameter requires Server 2008 or newer to take effect.
19fDisableAutoIndexingOnSchemaUpdateIndex creation is triggered by index-related changes to the searchFlags attribute. The default behavior is to delay index creation upon detection of index-related changes to the searchFlags attribute until either an administrator issues the schemaUpdateNow rootDSE modify operation, the DC is rebooted, or an implementation-dependent time period has elapsed.
This parameter requires Server 2012 or newer to take effect.
20twentiethCharMust be 2 if positions beyond 19 are to be set.
21DoNotVerifyUPNAndOrSPNUniquenessThe following names will not be verified for uniquenes on change:
1 = UPN
2 = SPN
3 = UPN + SPN
4 = SPN alias
5 = UPN + SPN alias
6 = SPN + SPN alias
7 = UPN + SPN + SPN alias
22 + 23MinimumGetChangesRequestVersionGETCHGREQ must have the minimum version specified by these two bytes.
24 + 25MinimumGetChangesReplyVersionGETCHGREPLY must have the minimum version specified by these two bytes.
26fLoadV1AddressBooksOnlySettingMAPI address book is calculated using V1 attributes. Otherwise V2 is used.
Only works with Windows Client/Server 1903 and newer.
27fTreatTokenGroupsAsLDAPTransitiveAttributeLDAP Policy “MaxValueRangeTransitive” is respected for token groups, otherwise “MaxValueRange” is respected.
Only works with Windows Client/Server 1903 and newer.
28AttributeAuthorizationOnLDAPAdd0 = KB5008383 LDAP Add AuthZ verification disabled (old default; not supported after 2023-04-11).
2 = KB5008383 LDAP Add AuthZ enforcement mode disabled, updated auditing disabled.
1 or other = KB5008383 LDAP Add AuthZ enforcement mode (new default).
Only works with Windows Server 2008R2 and newer.
29BlockOwnerImplicitRights0 = KB5008383 Owner Implicit Rights Audit enabled (old default until 2023-04-11).
2 = KB5008383 Owner Implicit Rights enforcement mode disabled.
1 or other = KB5008383 Owner Implicit Rights enforcement mode (new default).
Only works with Windows Server 2008R2 and newer.

I wrote a PowerShell functuon to resolve a given dsHeuristics value to a collection of objects.