Microsoft's official enterprise support blog for AD DS and more
Editor's note: This is the first of very likely many "DS Quickies". "Quickies" are shorter technical blog posts that relate hopefully-useful information and concepts for you to use in administering your networks. We thought about doing these on Twitter or something, but sadly we're still too technical to be bound by a 140-character limit :-)
For those of you who really look forward to the larger articles to help explain different facets of Windows, Active Directory, or troubleshooting, don't worry - there will still be plenty of those too.
Hi! This is Gonzalo writing to you from the support team for Latin America.
Recently we got a call from a customer, where one of the administrators accidentally executed a script that was intended to delete local users… on a domain controller. The result was that all domain users were deleted from the environment in just a couple of seconds. The good thing was that this customer had previously enabled Recycle Bin, but it still took a couple of hours to recover all users as this was a very large environment. This type of issue is something that comes up all the time, and it’s always painful for the customers who run into it. I have worked many cases where the lack of proper protection to objects caused a lot of issues for customer environments and even in some cases ended up costing administrators their jobs, all because of an accidental click. But, how can we avoid this?
If you take a look at the properties of any object in Active Directory, you will notice a checkbox named “Protect object from accidental deletion” under Object tab. When this enabled, permissions are set to denydeletion of this object to Everyone.
With the exception of Organizational Units, this setting is not enabled by default on all objects in Active Directory. When creating an object, it needs to be set manually. The challenge is how to easily enable this on thousands of objects.
ANSWER! Powershell!
Two simple PowerShell commands will enable you to set accidental deletion protection on all objects in your Active Directory. The first command will set this on any users or computers (or any object with value user on the ObjectClass attribute). The second command will set this on any Organizational Unit where the setting is not already enabled.
Get-ADObject -filter {(ObjectClass -eq "user")} | Set-ADObject -ProtectedFromAccidentalDeletion:$true
Get-ADOrganizationalUnit -filter * | Set-ADObject -ProtectedFromAccidentalDeletion:$true
Once you run these commands, your environment will be protected against accidental (or intentional) deletion of objects.
Note: As a proof of concept, I tested the script that my customer used with the accidental deletion protection enabled and none of the objects in my Active Directory environment were deleted.
Gonzalo “keep your job” Reyna
Welcome back! Kim Nichols here once again with the much anticipated Part 2 to Circle Back to Loopback. Thanks for all the comments and feedback on Part 1. For those of you joining us a little late in the game, you'll want to check out Part 1: Circle Back to Loopback before reading further.
In my first post, the goal was to keep it simple. Now, we're going to go into a little more detail to help you identify and troubleshoot Group Policy issues related to loopback processing. If you follow these steps, you should be able to apply what you've learned to any loopback scenario that you may run into (assuming that the environment is healthy and there are no other policy infrastructure issues).
To troubleshoot loopback processing you need to know and understand:
Know if loopback is enabled and in which mode
The first step in troubleshooting loopback is to know that it is enabled. It seems pretty obvious, I know, but often loopback is enabled by one administrator in one GPO without understanding that the setting will impact all computers that apply the GPO. This gets back to Part 1 of this blog . . . loopback processing is a computer configuration setting.
Take a deep cleansing breath and say it again . . . Loopback processing is a computer configuration setting. :-)
Everyone feels better now, right? The loopback setting configures a registry value on the computer to which it applies. The Group Policy engine reads this value and changes how it builds the list of applicable user policies based on the selected loopback mode.
The easiest way to know if loopback might be causing troubles with your policy processing is to collect a GPResult /h from the computer. Since loopback is a computer configuration setting, you will need to run GPResult from an administrative command prompt.
The good news is that the GPResult output will show you the winning GPO with loopback enabled. Unfortunately, it does not list all GPOs with loopback configured, just the one with the highest precedence.
If your OU structure separates users from computers, the GPResult output can also help you find GPOs containing user settings that are linked to computer OUs. Look for GPOs linked to computer OUs under the Applied GPOs section of the User Details of the GPResult output.
Below is an example of the output of the GPResult /h command from a Windows Server 2012 member server. The layout of the report has changed slightly going from Windows Server 2008 to Windows Server 2012, so your results may look different, but the same information is provided by previous versions of the tool. Notice that the link location includes the Computers OU, but we are in the User Details section of the report. This is a good indication that we have loopback enabled in a GPO linked in the path of the computer account.
Understand the desired state vs. the actual state
This one also sounds obvious, but in order to troubleshoot you have to know and understand exactly which settings you are expecting to apply to the user. This is harder than it sounds. In a lab environment where you control everything, it's pretty easy to keep track of desired configuration. However, in a production environment with potentially multiple delegated GPO admins, this is much more difficult.
GPResult gives us the actual state, but if you don't know the desired state at the setting level, then you can't reasonably determine if loopback is configured correctly (meaning you have WMI filters and/or security filtering set properly to achieve your desired configuration).
Review security filtering on GPOsOnce you determine which GPOs or which settings are not applying as expected, then you have a place to start your investigation.
In our experience here in support, loopback processing issues usually come down to incorrect security filtering, so rule that out first.
This is where things get tricky . . . If you are configuring custom security filtering on your GPOs, loopback can get confusing quickly. As a general rule, you should try to keep your WMI and security filtering as simple as possible - but ESPECIALLY when loopback is involved. You may want to consider temporarily unlinking any WMI filters for troubleshooting purposes. The goal is to ensure the policies you are expecting to apply are actually applying. Once you determine this, then you can add your WMI filters back into the equation. A test environment is the best place to do this type of investigation.
Setting up security filtering correctly depends on how you architect your policies:
The thing to keep in mind is that if you have what I would call "mixed use" GPOs, then your security filtering has to accommodate all of those uses. This is only a problem if you remove Authenticated Users from the security filter on the GPO containing the user settings. If you remove Authenticated Users from the security filter, then you have to think through which settings you are configuring, in which GPOs, to be applied to which computers and users, in which loopback mode....
Ouch. That's LOTS of thinking!
So, unless that sounds like loads of fun to you, it’s best to keep WMI and security filtering as simple as possible. I know that you can’t always leave Authenticated Users in place, but try to think of alternative solutions before removing it when loopback is involved.
Now to the part that everyone always asks about once they realize their current filter is wrong – How the heck should I configure the security filter?!
Security filtering requirements:
Merge mode requirements (Vista+):
User account:
READ and APPLY (these are the default permissions that are applied when you add users to the Security Filtering section of the GPO on the Scope tab in GPMC)
Computer account:
Minimum of READ permission
Replace mode requirements:
No permissions are required
The number one tool for troubleshooting loopback processing is your GPRESULT output and a solid understanding of the security filtering requirements for loopback processing in your GPO architecture (see above).
The GPRESULT will tell you which GPOs applied to the user. If a specific GPO failed to apply, then you need to review the security filtering on that GPO and verify:
The same strategy applies if you have mysterious policy settings applying after configuring loopback and you are not sure know why. Use your GPRESULT output to identify which GPO(s) the policy settings are coming from and then review the security filtering of those GPOs.
The Group Policy Operational logs from the computer will also tell you which GPOs were discovered and applied, but this is the same information that you will getfrom the GPRESULT.
After working my fair share of loopback-related cases, I've collected a list of recommendations for using loopback. This isn’t an official list of "best practices", but rather just some personal recommendations that may make your life easier. ENJOY!
I'll start with what is fast becoming my mantra: Keep it Simple. Pretty much all of my recommendations can come back to this point.
1. Don't use loopback :-)
OK, I know, not realistic. How about this . . . Don't use loopback unless you absolutely have to.
2. Use a separate GPO for the loopback setting; ONLY include the loopback setting in this GPO, and do not include the user settings. Name it Loopback-Merge or Loopback-Replace depending on the mode.
3. Avoid custom security filtering if you can help it.
4. Don't enable loopback in a GPO linked at the domain level!
5. Always test in a representative environment prior to deploying loopback in production.
That’s all folks! You are now ready to go forth and conquer all of those loopback policies!
Kim “1.21 Gigawatts!!” Nichols
Hey all, David here. Now that we’ve broken the silence, we here on the DS team felt that we owed you, dear readers, an explanation of some sort. Plus, we wanted to talk about the blog itself, some changes happening for us, and what you should hopefully be able to expect moving forward.
So, what had happened was….
As most of you know, a few months ago our editor-in-chief and the butt of many jokes here on the DS support team moved to a new position. We have it on good authority that he is thoroughly terrorizing many of our developers in Redmond with scary words like “documentation”, “supportability”, and other Chicago-style aphorisms which are best not repeated in print.
Unfortunately for us and for this blog, that left us with a little bit of a hole in the editing team! The folks left behind might have been superheroes, but the problem with being a superhero is that you get called on to go save the world (or a customer with a crisis) all the time, and that doesn’t leave much time for picking up your cape from the dry cleaners, let alone keeping up with editing blog submissions, doing mail sacks, and generally keeping the blog going.
At the same time, we had a bit of a reorganization internally. Where we were formerly one team within support, we are now two teams – DS (Directory Services) and ID (Identity). Why the distinction? Well, you may have heard about this Cloud thing…. But that’s a story best told by technical blog posts, really. For now, let’s just say the scope of some of what we do expanded last year from “a lot of people use it” to “internet scale”. Pretty scary when you think about it.
Just to make things even more confusing, about a month ago we were officially reunited with our long-lost (and slightly insane, but in a good way) brethren in the field engineering organization. That’s right, our two orgs have been glommed[1] together into one giant concentration of support engineering superpower. While it’s opening up some really cool stuff that we have always wanted to do but couldn’t before, it’s still the equivalent of waking up one day and finding out that all of those cousins you see every few years at family reunions are coming to live with you. In your house. Oh, and they’re bringing their dog.
Either way, the net effect of all this massive change was that we sort of got quiet for a few months. It wasn’t you, honest. It was us.
What to Expect
It’s important to us that we keep this blog current with detailed, pertinent technical info that helps you resolve issues that you might encounter, or even just helps you understand how our parts of Windows work a bit better. So, we’re picking that torch back up and we’ll be trying to get several good technical posts up each month for you. You may also see some shorter posts moving forward. The idea is to break up the giant articles and try to get some smaller, useful-to-know things out there every so often. Internally, we’re calling the little posts “DS Quickies” but no promises on whether we’ll actually give you that as a category to search on. Yes, we’re cruel like that. You’ll also see the return of the mail sack at some point in the near future, and most importantly you’re going to see some new names showing up as writers. We’ve put out the call, and we’re planning to bring you blog posts written not just by our folks in the Americas, but also in Europe and Asia. You can probably also expect some guest posts from our kin in the PFE organization, when they have something specific to what we do that they want to talk about.
At the same time, we’re keen on keeping the stuff that makes our blog useful and fun. So you can continue to expect technical depth, detailed analysis, plain-English explanations, and occasional irreverent, snarky humor. We’re not here to tell you why you should buy Windows clients or servers (or phones, or tablets) – we have plenty of marketing websites that do that better than we ever could. Instead, we’re here to help you understand how Windows works and how to fix problems when they occur. Although we do reserve the right to post blatant wackiness or fun things every so often too. Look, we don’t get out much, ok? This is our outlet. Just go with us on this.
Finally, you’re going to see me personally posting a bit more, since I’ve taken over as the primary editor for the site. I know - I tried to warn them what would happen, but they still gave me the job all the same. Jokes aside, I feel like it’s important that our blog isn’t just an encyclopedia of awesome technical troubleshooting, but also that it showcases the fact that we’re real people doing our best to make the IT world a better place, as sappy as that sounds. (Except for David Fisher– I’m convinced he’s really a robot). I have a different writing style than Ned and Jonathan, and a different sense of humor, but I promise to contain myself as much as possible. :-)
Sound good? We hope so. We’re going to go off and write some more technical stuff now – in fact: On deck for next week: A followup to Kim’s blog on Loopback Policy Processing.
We wanted to leave you with a funny video that’s safe for work to help kick off the weekend, but alas our bing fu was weak today. Got a good one to share? Feel free to link it for us in the comments!
[1]“Glom” is a technical term, by the way, not a managerial one. Needless to say, hijinks are continuing toensue.
-- David "Capes are cool" Beach
Hello, Joji Oshima here to dive deeper into the Claims Rule Language for AD FS. A while back I wrote a getting started post on the claims rule language in AD FS 2.0. If you haven't seen it, I would start with that article first as I'm going to build on the claims rule language syntax discussed in that earlier post. In this post, I'm going to cover more complex claim rules using Regular Expressions (RegEx) and how to use them to solve real world issues.
The use of RegEx allows us to search or manipulate data in many ways in order to get a desired result. Without RegEx, when we do comparisons or replacements we must look for an exact match. Most of the time this is sufficient but what if you need to search or replace based on a pattern? Say you want to search for strings that simply start with a particular word. RegEx uses pattern matching to look at a string with more precision. We can use this to control which claims are passed through, and even manipulate the data inside the claims.
Using RegEx to pattern match is accomplished by changing the standard double equals "==" to "=~" and by using special metacharacters in the condition statement. I'll outline the more commonly used ones, but there are good resources available online that go into more detail. For those of you unfamiliar with RegEx, let's first look at some common RegEx metacharacters used to build pattern templates and what the result would be when using them.
Symbol
Operation
Example rule
^
Match the beginning of a string
c:[type == "http://contoso.com/role", Value =~ "^director"]
=> issue (claim = c);
Pass through any role claims that start with "director"
$
Match the end of a string
c:[type == "http://contoso.com/email", Value =~ "contoso.com$"]
Pass through any email claims that end with "contoso.com"
|
OR
c:[type == "http://contoso.com/role", Value =~ "^director|^manager"]
Pass through any role claims that start with "director" or "manager"
(?i)
Not case sensitive
c:[type == "http://contoso.com/role", Value =~ "(?i)^director"]
Pass through any role claims that start with "director" regardless of case
x.*y
"x" followed by "y"
c:[type == "http://contoso.com/role", Value =~ "(?i)Seattle.*Manager"]
Pass through any role claims that contain "Seattle" followed by "Manager" regardless of case.
+
Match preceding character
c:[type == "http://contoso.com/employeeId", Value =~ "^0+"]
Pass through any employeeId claims that contain start with at least one "0"
*
Match preceding character zero or more times
Similar to above, more useful in RegExReplace() scenarios.
RegEx pattern matching can also be used in replacement scenarios. It is similar to a "find and replace", but using pattern matching instead of exact values. To use this in a claim rule, we use the RegExReplace() function in the value section of the issuance statement.
The RegExReplace() function accepts three parameters.
Example:
c:[type == "http://contoso.com/role"] => issue (Type = "http://contoso.com/role", Value = RegExReplace(c.Value, "(?i)director", "Manager");
Pass through any role claims. If any of the claims contain the word "Director", RegExReplace() will change it to "Manager". For example, "Director of Finance" would pass through as "Manager of Finance".
Let's look at some real world examples of regular expressions in claims rules.
We want to add claims for all group memberships, including distribution groups.
Typically, group membership is added using the wizard and selecting Token-Groups Unqualified Names and map it to the Group or Role claim. This will only pull security groups, not distribution groups, and will not contain Domain Local groups.
We can pull from memberOf, but that will give us the entire distinguished name, which is not what we want. One way to solve this problem is to use three separate claim rules and use RegExReplace() to remove unwanted data.
Phase 1: Pull memberOf, add to working set "phase 1"
c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]=> add(store = "Active Directory", types = ("http://test.com/phase1"), query = ";memberOf;{0}", param = c.Value);
Example: "CN=Group1,OU=Users,DC=contoso,DC=com" is put into a phase 1 claim.
Phase 2: Drop everything after the first comma, add to working set "phase 2"
c:[Type == "http://test.com/phase1"]=> add(Type = "http://test.com/phase2", Value = RegExReplace(c.Value, ",[^\n]*", ""));
Example: We process the value in the phase 1 claim and put "CN=Group1" into a phase 2 claim.
Digging Deeper: RegExReplace(c.Value, ",[^\n]*", "")
Phase 3: Drop CN= at the beginning, add to outgoing claim set as the standard role claim
c:[Type == "http://test.com/phase2"]
=> issue(Type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role", Value = RegExReplace(c.Value, "^CN=", ""));
Example: We process the value in phase 2 claim and put "Group1" into the role claim
Digging Deeper: RegExReplace(c.Value, "^CN=", "")
We need to compare the values in two different claims and only allow access to the relying party if they match.
In this case we can use RegExReplace(). This is not the typical use of this function, but it works in this scenario. The function will attempt to match the pattern in the first data set with the second data set. If they match, it will issue a new claim with the value of "Yes". This new claim can then be used to grant access to the relying party. That way, if these values do not match, the user will not have this claim with the value of "Yes".
c1:[Type == "http://adatum.com/data1"] &&
c2:[Type == "http://adatum.com/data2"]
=> issue(Type = "http://adatum.com/UserAuthorized", Value = RegExReplace(c1.Value, c2.Value, "Yes"));
Example: If there is a data1 claim with the value of "contoso" and a data2 claim with a value of "contoso", it will issue a UserAuthorized claim with the value of "Yes". However, if data1 is "adatum" and data2 is "fabrikam", it will issue a UserAuthorized claim with the value of "adatum".
Digging Deeper: RegExReplace(c1.Value, c2.Value, "Yes")
Let's take a second look at potential issue with our solution to problem 2. Since we are using the value of one of the claims as the RegEx syntax, we must be careful to check for certain RegEx metacharacters that would make the comparison mean something different. The backslash is used in some RegEx metacharacters so any backslashes in the values will throw off the comparison and it will always fail, even if the values match.
In order to ensure that our matching claim rule works, we must sanitize the input values by removing any backslashes before doing the comparison. We can do this by taking the data that would go into the initial claims, put it in a holding attribute, and then use RegEx to strip out the backslash. The example below only shows the sanitization of data1, but it would be similar for data2.
Phase 1: Pull attribute1, add to holding attribute "http://adatum.com/data1holder"
c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]
=> add(store = "Active Directory", types = ("http://adatum.com/data1holder"), query = ";attribute1;{0}", param = c.Value);
Example: The value in attribute 1 is "Contoso\John" which is placed in the data1holder claim.
Phase 2: Strip the backslash from the holding claim and issue the new data1 claim
c:[Type == "http://adatum.com/data1holder", Issuer == "AD AUTHORITY"]
=> issue(type = "http://adatum.com/data1", Value = RegExReplace(c.Value,"\\","");
Example: We process the value in the data1holder claim and put "ContosoJohn" in a data1 claim
Digging Deeper: RegExReplace(c.Value,"\\","")
An alternate solution would be to pad each backslash in the data2 value with a second backslash. That way each backslash would be represented as a literal backslash. We could accomplish this by using RegExReplace(c.Value,"\\","\\") against a data2 input value.
Employee numbers vary in length, but we need to have exactly 9 characters in the claim value. Employee numbers that are shorter than 9 characters should be padded in the front with leading zeros.
In this case we can create a buffer claim, join that with the employee number claim, and then use RegEx to use the right most 9 characters of the combined string.
Phase 1: Create a buffer claim to create the zero-padding
=> add(Type = "Buffer", Value = "000000000");
Phase 2: Pull the employeeNumber attribute from Active Directory, place it in a holding claim
=> add(store = "Active Directory", types = ("ENHolder"), query = ";employeeNumber;{0}", param = c.Value);
Phase 3: Combine the two values, then use RegEx to remove all but the 9 right most characters.
c1:[Type == "Buffer"]
&& c2:[Type == "ENHolder"]
=> issue(Type = "http://adatum.com/employeeNumber", Value = RegExReplace(c1.Value + c2.Value, ".*(?=.{9}$)", ""));
Digging Deeper: RegExReplace(c1.Value + c2.Value, ".*(?=.{9}$)", "")
Employee numbers contain leading zeros but we need to remove those before sending them to the relying party.
In this case we can pull employee number from Active Directory and place it in a holding claim, then use RegEx to use the strip out any leading zeros.
Phase 1: Pull the employeeNumber attribute from Active Directory, place it in a holding claim
Phase 2: Take the value in ENHolder and remove any leading zeros.
c:[Type == "ENHolder"]
=> issue(Type = "http://adatum.com/employeeNumber", Value = RegExReplace(c.Value, "^0*", ""));
Digging Deeper: RegExReplace(c.Value, "^0*", "")
As you can see, RegEx adds powerful functionality to the claims rule language. It has a high initial learning curve, but once you master it you will find that there are few scenarios that RegEx can't solve. I would highly recommend searching for an online RegEx syntax tester as it will make learning and testing much easier. I'll continue to expand the TechNet wiki article so I would check there for more details on the claims rule language.
Understanding Claim Rule Language in AD FS 2.0
AD FS 2.0: Using RegEx in the Claims Rule Language
Regular Expression Syntax
AD FS 2.0 Claims Rule Language Primer
Until next time,
Joji "Claim Jumper" Oshima
Hello again! Kim Nichols here again. For this post, I'm taking a break from the AD LDS discussions (hold your applause until the end) and going back to a topic near and dear to my heart - Group Policy loopback processing.
Loopback processing is not a new concept to Group Policy, but it still causes confusion for even the most experienced Group Policy administrators.
This post is the first part of a two part blog series on User Group Policy Loopback processing.
Hopefully these posts will refresh your memory and provide some tips for troubleshooting Group Policy processing when loopback is involved.
Before we dig in too deeply, let's quickly cover normal Group Policy processing. Thinking back to when we first learned about Group Policy processing, we learned that Group Policyapplies in the following order:
You may have heard Active Directory “old timers” refer to this as LSDOU. As a result of LSDOU, settings from GPOs linked closest (lower in OU structure) to the user take precedence over those linked farther from the user (higher in OU structure). GPO configuration options such as Block Inheritance and Enforced (previously called No Override for you old school admins) can modify processing as well, but we will keep things simple for the purposes of this example. Normal user group policy processing applies user settings from GPOs linked to the Site, Domain, and OU containing the user object regardless of the location of the computer object in Active Directory.
Let's use a picture to clarify this. For this example, the user is the "E" OU and the computer is in the "G" OU of the contoso.com domain.
Following normal group policy processing rules (assuming all policies apply to Authenticated Users with no WMI filters or "Block Inheritance" or "Enforced" policies), user settings of Group Policy objects apply in the following order:
That’s pretty straightforward, right? Now, let’s move on to loopback processing!
Group Policy loopback is a computer configuration setting that enables different Group Policy user settings to apply based upon the computer from which logon occurs.
Breaking this down a little more:
Administrators use loopback processing in kiosk, lab, and Terminal Server environments to provide a consistent user experience across all computers regardless of the GPOs linked to user's OU.
Our recommendation for loopback is similar to our recommendations for WMI filters, Block Inheritance and policy Enforcement; use them sparingly. All of these configuration options modify the default processing of policy and thus make your environment more complex to troubleshoot and maintain. As I've mentioned in other posts, whenever possible, keep your designs as simple as possible. You will save yourself countless nights/weekends/holidays in the office because will you be able to identify configuration issues more quickly and easily.
The loopback setting is located under Computer Configuration/Administrative Templates/System/Group Policy in the Group Policy Management Editor (GPME).
Use the policy setting Configure user Group Policy loopback processing mode to configure loopback in Windows 8 and Windows Server 2012. Earlier versions of Windows have the same policy setting under the name User Group Policy loopback processing mode. The screenshot below is from the Windows 8 version of the GPME.
When you enable loopback processing, you also have to select the desired mode. There are two modes for loopback processing: Merge or Replace.
Prior to the start of user policy processing, the Group Policy engine checks to see if loopback is enabled and, if so, in which mode.
We'll start off with an explanation of Merge mode since it builds on our existing knowledge of user policy processing.
During loopback processing in merge mode, user GPOs process first (exactly as they do during normal policy processing), but with an additional step. Following normal user policy processing the Group Policy engine applies user settings from GPOs linked to the computer's OU. The result-- the user receives all user settings from GPOs applied to the user and all user settings from GPOs applied to the computer. The user settings from the computer’s GPOs win any conflicts since they apply last.
To illustrate loopback merge processing and conflict resolution, let’s use a simple chart. The chart shows us the “winning” configuration in each of three scenarios:
Now, going back to our original example, loopback processing in Merge mode applies user settings from GPOs linked to the user’s OU followed by user settings from GPOs linked to the computer’s OU.
GPOs for the user in OU ”E” apply in the following order (the first part is identical to normal user policy processing from our original example):
Loopback replace is much easier. During loopback processing in replace mode, the user settings applied to the computer “replace” those applied to the user. In actuality, the Group Policy service skips the GPOs linked to the user’s OU. Group Policy effectively processes as if user object was in the OU of the computer rather than its current OU.
The chart for loopback processing in replace mode shows that settings “1” and “2” do not apply since all user settings linked to the user’s OU are skipped when loopback is configured in replace mode.
Returning to our example of the user in the “E” OU, loopback processing in replace mode skips normal user policy processing and only applies user settings from GPOs linked to the computer.
The resulting processing order is:
Those are the basics of user group policy loopback processing. In my next post, I'll cover the troubleshooting process when loopback is enabled.
Kim “Why does it say paper jam, when there is no paper jam!?” Nichols
Hello again everyone! David here to discuss a scenario that is becoming more and more popular for administrators of Distributed File System Namespaces (DFSN): consolidation of one or more standalone namespaces that are referenced by a domain-based namespace. Below I detail how this may be achieved.
First, we should quickly review the history of why so many administrators designed interlinked namespaces.
In Windows Server 2003 (and earlier) versions of DFSN, domain-based namespaces were limited to hosting approximately 5,000 DFS folders per namespace. This limitation was simply due to how the Active Directory JET database engine stored a single binary value of an attribute. We now refer to this type of namespace as "Windows 2000 Server Mode". Standalone DFS namespaces (those stored locally in the registry of a single namespace server or server cluster) are capable of approximately 50,000 DFS folders per namespace. Administrators would therefore create thousands of folders in a standalone namespace and then interlink (cascade) it with a domain-based namespace. This allowed for a single, easily identifiable entry point of the domain-based namespace and leveraged the capacity of the standalone namespaces.
"Windows Server 2008 mode" namespaces allow for domain-based namespaces of many thousands of DFS folders per namespace (look here for scalability test results). With many Active Directory deployments currently capable of supporting 2008 mode namespaces, Administrators are wishing to remove their dependency on the standalone namespaces and roll them up into a single domain-based namespace. Doing so will improve referral performance, improve fault-tolerance of the namespace, and ease administration.
Below are the steps required to consolidate one or more standalone namespaces into an existing domain-based namespace. The foremost goal of this process is to maintain identical UNC paths after the consolidation so that no configuration changes are needed for clients, scripts, or anything else that references the current interlinked namespace paths. Because so many design variations exist, you may only require a subset of the operations or you may have to repeat some procedures multiple times. If you are not concerned with maintaining identical UNC paths, then this blog does not really apply to you.
For demonstration purposes, I will perform the consolidation steps on a namespace with the following configuration:
Domain-based Namespace: \\tailspintoys.com\dataDFS folder: "reporting" (targeting the standalone namespace "reporting" below)Standalone Namespace: \\server1\reportingDFS folders: "report####" (totaling 10,000 folders)
Below is what these namespaces look like in the DFS Management MMC.
Domain Namespace DATA:
Standalone Namespace "Reporting" hosted by server "FS1" and has 15,000 DFS folders:
For a client to access a file in the "report8000" folder in the current DFS design, the client must access the following path: \\tailspintoys.com\data\reporting\report8000
Below are the individual elements of that UNC path with descriptions below each:
\\tailspintoys.com
\Data
\Reporting
\Reporting8000
Domain
Domain-based Namespace
Domain-Based Namespace folder
Standalone Namespace
Standalone Namespace folder targeting a file server share
Note the overlap of the domain-based namespace folder "reporting" (dark green) with the standalone namespace "reporting" (light green). Each item in the UNC path is separated by a "\" and is known as a "path component".
In order to preserve the UNC path using a single domain-based namespace we must leverage the ability for DFSN to host multiple path components within a single DFS folder. Currently, the "reporting" DFS folder of the domain-based namespace refers clients to the standalone namespace that contains DFS folders, such as "reporting8000", beneath it. To consolidate those folders of the standalone root to the domain-based namespace, we must merge them together.
To illustrate this, below is how the new consolidated "Data" domain-based namespace will be structured for this path:
\Reporting\Reporting8000
Domain-based Namespace folder targeting a file server share
Notice how the name of the DFS folder is "Reporting\Reporting8000" and includes two path components separated by a "\". This capability of DFSN is what allows for the creation of any desired path. When users access the UNC path, they ultimately will still be referred to the target file server(s) containing the shared data. "Reporting" is simply a placeholder serving to maintain that original path component.
Below are the steps and precautions for consolidating interlinked namespaces. It is highly recommended to put a temporary suspension on any administrative changes to the standalone namespace(s).
Assumptions: The instructions assume that you have already met the requirements for "Windows Server 2008 mode" namespaces and your domain-based namespace is currently running in "Windows 2000 Server mode".
However, if you have not met these requirements and have a "Windows 2000 Server mode" domain-based namespace, these instructions (with modifications) may still be applied *if* after consolidation the domain-based namespace configuration data is less than 5 MB in size. If you are unsure of the size, you may run the "dfsutil /root:\\<servername>\<namespace_name> /view" command against the standalone namespace and note the size listed at the top (or bottom) of the output. The reported size will be added to the current size of the domain-based namespace and must not exceed 5 MB. Cease any further actions if you are unsure, or test the operations in a lab environment. Of course, if your standalone namespace size was less than 5 MB in size, then why did you create a interlinked namespace to begin with? Eh…I'm not really supposed to ask these questions. Moving on…
Export the standalone namespace.
Dfsutil root export \\fs1\reporting c:\exports\reporting_namespace.txt
Modify the standalone namespace export file using a text editor capable of search-and-replace operations. Notepad.exe has this capability. This export file will be leveraged later to create the proper folders within the domain-based namespace.Replace the "Name" element of the standalone namespace with the name of the domain-based namespace and replace the "Target" element to be the UNC path of the domain-based namespace server (the one you will be configuring later in step 6). Below, I highlighted the single "\\FS1\reporting" 'name' element that will be replaced with "\\TAILSPINTOYS.COM\DATA". The single "\\FS1\reporting" element immediately below it will be replaced with "\\DC1\DATA" as "DC1" is my namespace server.Next, prepend "Reporting\" to the folder names listed in the export. The final result will be as follows:
One trick is to utilize the 'replace' capability of Notepad.exe to search out and replace all instances of the '<Link Name="' string with '<Link Name="folder\' ('<Link Name="Reporting\' in this example). The picture below shows the original folders defined and the 'replace' dialog responsible for changing the names of the folders (click 'Replace all' to replace all occurrences).Save the modified file with a new filename (reporting_namespace_modified.txt) so as to not overwrite the standalone namespace export file.
Export the domain-based namespacedfsutil root export \\tailspintoys.com\data c:\exports\data_namespace.txt
Open the output file from Step 3 and delete the link that is being consolidated ("Reporting"):
Save the file as a separate file (data_namespace_modified.txt). This export will be utilized to recreate the *other* DFS folders within the "Windows Server 2008 Mode" domain-based namespace that do not require consolidation.
This critical step involves deleting the existing domain-based namespace. This is required for the conversion from "Windows 2000 Server Mode" to "Windows Server 2008 Mode".
Delete the domain-based namespace ("DATA" in this example).
Recreate the "DATA" namespace, specifying the mode as "Windows Server 2008 mode". Specify the namespace server to be a namespace server with close network proximity to the domain's PDC. This will significantly decrease the time it takes to import the DFS folders. Additional namespace servers may be added any time after Step 8.
Import the modified export file created in Step 4:dfsutil root import merge data_namespace_modified.txt \\tailspintoys.com\dataIn this example, this creates the "Business" and "Finance" DFS folders:
Import the modified namespace definition file created in Step 2 to create the required folders (note that this operation may take some time depending on network latencies and other factors):dfsutil root import merge reporting_namespace_modified.txt \\tailspintoys.com\DATA
Verify the structure of the namespace:
Test the functionality of the namespace. From a client or another server, run the "dfsutil /pktflush" command to purge cached referral data and attempt access to the DFS namespace paths. Alternately, you may reboot clients and attempt access if they do not have dfsutil.exe available.Below is the result of accessing the "report8000" folder path via the new namespace: Referral cache confirms the new namespace structure (red line highlighting the name of the DFS folder as "reporting\report8000"):
At this point, you should have a fully working namespace. If something is not working quite right or there are problems accessing the data, you may return to the original namespace design by deleting all DFS folders in the new domain-based namespace and importing the original namespace from the export file (or recreating the original folders by hand). At no time did we alter the standalone namespaces, so returning to the original interlinked configuration is very easy to accomplish.
Add the necessary namespace servers to the domain-based namespace to increase fault tolerance.
Notify all previous administrators of the standalone namespace(s) that they will need to manage the domain-based namespace from this point forward. Once you confident with the new namespace, the original standalone namespace(s) may be retired at any time (assuming no systems on the network are using UNC paths directly to the standalone namespace).
What would the process be if the domain-based namespace is already running in "Windows Server 2008 mode"? Or, you have already run through the operations once and wish to consolidate additional DFS folders? Some steps remain the same while others are skipped entirely: Steps 1-2 (same as detailed previously to export the standalone namespace and modify the export file) Step 3 Export the domain-based namespace for backup purposesStep 4 Delete the DFS folder targeting the standalone namespace--the remainder of the domain-based namespace will remain unchangedStep 8 Import the modified file created in step 2 to the domain-based namespaceStep 9-10 Verify the structure and function of the namespace
Ensure that no data exists in the original standalone namespace server's namespace share. Because clients are now no longer using the standalone namespace, the "reporting" path component exists as a subfolder within each domain-based namespace server's share. Furthermore, hosting data within the namespace share (domain-based or standalone) is not recommended. If this applies to you, consider moving such data into a separate folder within the new namespace and update any references to those files used by clients.
These operations should be performed during a maintenance window. The length of which is dictated by your efficiency in performing the operations and the length of time it takes to import the DFS namespace export file. Because a namespace is so easily built, modified, and deleted, you may wish to consider a "dry run" of sorts. Prior to deleting your production namespace(s), create a new test namespace (e.g. "DataTEST"), modify your standalone namespace export file (Step 2) to reference this "DataTEST" namespace and try the import. Because you are using a separate namespace, no changes will occur to any other production namespaces. You may gauge the time required for the import, and more importantly, test access to the data (\\tailspintoys.com\DataTEST\Reporting\Reporting8000 in my example). If access to the data is successful, then you will have confidence in replacing the real domain-based namespace.
Clients should not be negatively affected by the restructuring as they will discover the new hierarchy automatically. By default, clients cache namespace referrals for 5 minutes and folder referrals for 30 minutes. It is advisable to keep the standalone namespace(s) operational for at least an hour or so to accommodate transition to the new namespace, but it may remain in place for as long as you wish. If you decommission the standalone namespace and find some clients are still using it directly, you could easily recreate the standalone namespace from our export in Step 1 while you investigate the client configurations and remove their dependency on it.
Lastly, if you are taking the time and effort to recreate the namespace for "Windows Server 2008 mode" support, you might as well consider configuring the targets of the DFS folders with DNS names (modify the export files) and also implementing DFSDnsConfig on the namespace servers.
I hope this blog eliminates some of the concerns and fears of consolidating interlinked namespaces!
Dave "King" Fisher
Hello. Jim here again to elucidate on the wonderment of change notification as it relates to Active Directory replication within and between sites. As you know Active Directory replication between domain controllers within the same site (intrasite) happens instantaneously. Active Directory replication between sites (intersite) occurs every 180 minutes (3 hours) by default. You can adjust this frequency to match your specific needs BUT it can be no faster than fifteen minutes when configured via the AD Sites and Services snap-in.
Back in the old days when remote sites were connected by a string and two soup cans, it was necessary in most cases to carefully consider configuring your replication intervals and times so as not to flood the pipe (or string in the reference above) with replication traffic and bring your WAN to a grinding halt. With dial up connections between sites it was even more important. It remains an important consideration today if your site is a ship at sea and your only connectivity is a satellite link that could be obscured by a cloud of space debris.
Now in the days of wicked fast fiber links and MPLS VPN Connectivity, change notification may be enabled between site links that can span geographic locations. This will make Active Directory replication instantaneous between the separate sites as if the replication partners were in the same site. Although this is well documented on TechNet and I hate regurgitating existing content, here is how you would configure change notification on a site link:
There is one caveat however. Change notification will fail with manual connection objects. If your connection objects are not created by the KCC the change notification setting is meaningless. If it's a manual connection object, it will NOT inherit the Options bit from the Site Link. Enjoy your 15 minute replication latency.
Why would you want to keep connection objects you created manually, anyway? Why don't you just let the KCC do its thing and be happy? Maybe you have a Site Link costing configuration that you would rather not change. Perhaps you are at the mercy of your networking team and the routing of your network and you must keep these manual connections. If, for whatever reason you must keep the manually created replication partners, be of good cheer. You can still enjoy the thrill of change notification.
Change Notification on a manually created replication partner is configured by doing the following:
If the value is anything other than zero, you must do some binary math. Relax; this is going to be fun.
On the Site Link object, it's the 1st bit that controls change notification. On the Connection object, however, it's the 4th bit. The 4th bit is highlighted in RED below represented in binary (You remember binary don't you???)
Binary Bit
8th
7th
6th
5th
4th
3rd
2nd
1st
Decimal Value
128
64
32
16
8
4
2
1
NOTE: The values represented by each bit in the Options attribute are documented in the Active Directory Technical Specification. Fair warning! I'm only including that information for the curious. I STRONGLY recommend against setting any of the options NOT discussed specifically in existing documentation or blogs in your production environment.
Remember what I said earlier? If it's a manual connection object, it will NOT inherit the Options value from the Site Link object. You're going to have to enable change notifications directly on the manually created connection object.
Take the value of the Options attribute, let's say it is 16.
Open Calc.exe in Programmer mode, and paste the contents of your options attribute.
Click on Bin, and count over to the 4th bit starting from the right.
That's the bit that controls change notification on your manually created replication partner. As you can see, in this example it is zero (0), so change notifications are disabled.
Convert back to decimal and add 8 to it.
Click on Bin, again.
As you can see above, the bit that controls change notification on the manually created replication partner is now 1. You would then change the Options value in ADSIEDIT from 16 to 24.
Click on Ok to commit the change.
Congratulations! You have now configured change notification on your manually created connection object. This sequence of events must be repeated for each manually created connection object that you want to include in the excitement and instantaneous gratification of change notification. Keep in mind that in the event something (or many things) gets deleted from a domain controller, you no longer have that window of intersite latency to stop inbound replication on a downstream partner and do an authoritative restore. Plan the configuration of change notifications accordingly. Make sure you take regular backups, and test them occasionally!
And when you speak of me, speak well…
Jim "changes aren't permanent, but change is" Tierney
Hello again ADAMSyncers! Kim Nichols here again with what promises to be a fun and exciting mystery solving adventure on the joys of ADAMSync and AD Recycle Bin (ADRB) for AD LDS. The goal of this post is two-fold:
I'll start with some background on AD Recycle Bin for AD LDS and then go through a recent mind-boggling scenario from beginning to end to explain why you may not want (or need) to enable AD Recycle Bin if you are planning on using ADAMSync.
Hold on to your hats!
If you're not familiar with AD Recycle Bin and what it can do for you, check out Ned's prior blog posts or the content available on TechNet.
The short version is that AD Recycle Bin is a feature added in Windows Server 2008 R2 that allows Administrators to recover deleted objects without restoring System State backups and performing authoritative restores of those objects.
To enable AD Recycle Bin (ADRB) for AD DS your forest needs to meet some basic requirements:
What you may not be aware of is that AD LDS has this feature as well. The requirements for implementing ADRB in AD LDS are the same as AD DS although they are not as intuitive for AD LDS instances.
If your AD LDS instance was originally built as an ADAM instance, then you may or may not have extended the schema of your instance to Windows Server 2008 R2. If not, upgrading the schema is a necessary first step in order to support ADRB functionality.
To update your AD LDS schema to Windows Server 2008 R2, run the following command from your ADAM installation directory on your AD LDS server:
Ldifde.exe –i –f MS-ADAM-Upgrade-2.ldf –s server:port –b username domain password –j . -$ adamschema.cat
You'll also want to update your configuration partition:
ldifde –i –f ms-ADAM-Upgrade-1.ldf –s server:portnumber –b username domain password –k –j . –c "CN=Configuration,DC=X" #configurationNamingContext
Information on these commands can be found on TechNet:
In an AD DS environment, ADRB requires that all domain controllers in the forest be running Windows Server 2008 R2. Translating this to an AD LDS scenario, all servers in your replica set must be running Windows Server 2008 R2. So, if you've been hanging on to those Windows Server 2003 ADAM servers for some reason, now is the time to decommission them.
LaNae's blog "How to Decommission an ADAM/ADLDS server and Add Additional Servers" explains the process for removing a replica member. The process is pretty straightforward and just involves uninstalling the instance, but you will want to check FSMO role ownership, overall instance health, and application configurations before blindly uninstalling. Now is not the time to discover applications have been hard-coded to point to your Windows Server 2003 server or that you've been unknowingly been having replication issues.
In AD DS, raising the domain and forest functional levels is easy; there's a UI -- AD Domains and Trusts. AD LDS doesn't have this snap-in, though, so it is a little more complicated. There's a good KB article (322692) that details the process of raising the functional levels of AD and gives us insight into what we need to do raise our AD LDS functional level since we can't use the AD Domains and Trusts MMC.
AD LDS only has the concept of forest functional levels. There is no domain functional level in AD LDS. The forest functional level is controlled by the msDS-Behavior-Version attribute on the CN=Partitions object in the Configuration naming context of your AD LDS instance.
Simply changing the value of msDS-Behavior-Version from 2 to 4 will update the functional level of your instance from Windows Server 2003 to Windows Server 2008 R2. Alternatively, you can use Windows PowerShell to upgrade the functional level of your AD LDS instance. For AD DS, there is a dedicated Windows PowerShell cmdlet for raising the forest functional level called Set-ADForestMode, but this cmdlet is not supported for AD LDS. To use Windows PowerShell to raise the functional level for AD LDS, you will need to use the Set-ADObject cmdlet to specify the new value for the msDS-Behavior-Version attribute.
To raise the AD LDS functional level using Windows PowerShell, run the following command (after loading the AD module):
Set-ADObject -Identity <path to Partitions container in Configuration Partition of instance> -Replace @{'msds-Behavior-Version'=4} -Server <server:port>
For example in my environment, I ran:
Set-ADObject -Identity 'CN=Partitions,CN=Configuration,CN={A1D2D2A9-7521-4068-9ACC-887EDEE90F91}' -Replace @{'msDS-Behavior-Version'=4} -Server 'localhost:50000'
As always, before making changes to your production environment:
Now we're ready to enable AD Recycle Bin!
For Windows Server 2008 R2, the process for enabling ADRB in AD LDS is nearly identical to that for AD DS. Either Windows PowerShell or LDP can be used to enable the feature. Also, there is no UI for enabling ADRB for AD LDS in Windows Server 2008 R2 or Windows Server 2012. Windows Server 2012 does add the ability to enable ADRB and restore objects through the AD Administrative Center for AD DS (you can read about it here), but this UI does not work for AD LDS instances on Windows Server 2012.
Once the feature is enabled, it cannot be disabled. So, before you continue, be certain you really want to do this. (Read this whole post to help you decide.)
The ADRB can be enabled in both AD DS and AD LDS using a PowerShell cmdlet, but the syntax is slightly different between the two. The difference is fully documented in TechNet.
In my lab, I used the PowerShell cmdlet to enable the feature rather than using LDP. Below is the syntax for AD LDS:
Enable-ADOptionalFeature 'recycle bin feature' -Scope ForestOrConfigurationSet -Server <server:port> -Target <DN of configuration partition>
Here's the actual cmdlet I used and a screenshot of the output. The cmdlet asks you confirm that you want to enable the feature since this is an irreversible process.
You can verify that the command worked by checking the msDS-EnabledFeature attribute on the Partitions container of the Configuration NC of your instance.
Now, on to what prompted this post in the first place.
Once ADRB is enabled, there is a change to how deleted objects are handled when they are removed from the directory. Prior to enabling ADRB when an object is deleted, it is moved to the Deleted Objects container within the application partition of your instance (CN=Deleted Objects, DC=instance1, DC=local or whatever the name of your instance is) and most of the attributes are deleted. Without Recycle Bin enabled, a user object in the Deleted Object container looks like this in LDP:
After enabling ADRB, a deleted user object looks like this in LDP:
Notice that after enabling ADRB, givenName, displayName, and several other attributes including userPrincipalName (UPN) are maintained on the object while in the Deleted Objects container. This is great if you ever need to restore this user: most of the data is retained and it's a pretty simple process using LDP or PowerShell to reanimate the object without the need to go through the authoritative restore process. But, retaining the UPN attribute specifically can cause issues if ADAMSync is being used to synchronize objects from AD DS to AD LDS since the userPrincipalName attribute must be unique within an AD LDS instance.
In general, the recommendation when using ADAMSync, is to perform all user management (additions/deletions) on the AD DS side of the sync and let the synchronization process handle the edits in AD LDS. There are times, though, when you may need to remove users in AD LDS in order to resolve synchronization issues and this is where having ADRB enabled will cause problems.
For example:
Let's say that you discover that you have two users with the same userPrincipalName in AD and this is causing issues with ADAMSync: the infamous ATT_OR_VALUE_EXISTS error in the ADAMSync log.
====================================================
Processing Entry: Page 67, Frame 1, Entry 64, Count 1, USN 0 Processing source entry <guid=fe36238b9dd27a45b96304ea820c82d8> Processing in-scope entry fe36238b9dd27a45b96304ea820c82d8.
Adding target object CN=BillyJoeBob,OU=User Accounts,dc=fabrikam,dc=com. Adding attributes: sourceobjectguid, objectClass, sn, description, givenName, instanceType, displayName, department, sAMAccountName, userPrincipalName, Ldap error occurred. ldap_add_sW: Attribute Or Value Exists. Extended Info: 0000217B: AtrErr: DSID-03050758, #1:
0: 0000217B: DSID-03050758, problem 1006 (ATT_OR_VALUE_EXISTS), data 0, Att 90290 (userPrincipalName)
. Ldap error occurred. ldap_add_sW: Attribute Or Value Exists. Extended Info: 0000217B: AtrErr: DSID-03050758, #1:
===============================================
Upon further inspection of the users, you determine that at some point a copy was made of the user's account in AD and the UPN was not updated. The old account is not needed anymore but was never cleaned up either. To get your ADAMSync working, you:
BWAMP!
The sync still fails with the ATT_OR_VALUE_EXISTS error on the same user. This doesn't make sense, right? You deleted the extra user in AD and cleaned up AD LDS by deleting the user account there. There should be no duplicates. The ATT_OR_VALUE_EXISTS error is not an ADAMSync error. ADAMSync is making LDAP calls to the AD LDS instance to create or modify objects. This error is an LDAP error from the AD LDS instance and is telling you already have an object in the directory with that same userPrincipalName. For what it's worth, I've never seen this error logged if the duplicate isn't there. It is there; you just have to find it!
At this point, it's not hard to guess where the duplicate is coming from, since we've already discussed ADRB and the attributes maintained on deletion. The duplicate userPrincipalName is coming from the object we deleted from the AD LDS instance and is located in the Deleted Objects container. The good news is that LDP allows you to browse the container to find the deleted object. If you've never used LDP before to look through the Deleted Objects container, TechNet provides information on how to browse for deleted objects via LDP.
It's great that we know why we are having the problem, but how do we fix it? Now that we're already in this situation, the only way to fix it is to eliminate the duplicate UPN from the object in CN=Deleted Objects. To do this:
Now your sync should complete successfully!
So, I was feeling pretty good about myself on this case. I spent hours figuring out ADRB for AD LDS and setting up the repro in my lab and proving that deleting objects with ADRB enabled could cause ATT_OR_VALUE_EXISTS errors during ADAMSync. I was already patting myself on the back and starting my victory lap when I got an email back from my customer stating the msDS-BehaviorVersion attribute on their AD LDS instance was still set to 2.
Huh?!
I'll admit it, I was totally confused. How could this be? I had LDP output from the customer's AD LDS instance and could see that the userPrincipalName attribute was being maintained on objects in the Deleted Objects container. I knew from my lab that this is not normal behavior when ADRB is disabled. So, what the heck is going on?
I know when I'm beat, so decided to use one of my "life lines" . . . I emailed Linda Taylor. Linda is an Escalation Engineer in the UK Directory Services team and has been working with ADAM and AD LDS much longer than I have. This is where I should include a picture of Linda in a cape because she came to the rescue again!
Apparently, there is more than one way for an attribute to be maintained on deletion. The most obvious was that ADRB had been enabled. The less obvious requires a better understanding of what actually happens when an object is deleted. Transformation into a Tombstone documents this process in more detail. The part that is important to us is:
The Schema Management snap-in doesn't allow us to see attributes on attributes, so to verify the value of searchFlags on the userPrincipalName attribute we need to ADSIEdit or LDP.
WARNING: Modifying the schema can have unintended consequences. Please be certain you really need to do this before proceeding and always test first!
By default, the searchFlags attribute on userPrincipalName should be set to 0x1 (INDEX).
My customer's searchFlags attribute was set to 0x1F (31 decimal) = (INDEX |CONTAINER_INDEX |ANR |PRESERVE_ON_DELETE |COPY).
Apparently these changes to the schema had been made to improve query efficiency when searching on the userPrincipalName attribute.
Reminder: Manually modifying the schema in this way is not something you should doing unless are certain you know what you are doing or have been directed to by Microsoft Support.
The searchFlags attribute is a bitwise attribute containing a number of different options which are outlined here. This attribute can be zero or a combination of one or more of the following values:
Value
Description
1 (0x00000001)
Create an index for the attribute.
2 (0x00000002)
Create an index for the attribute in each container.
4 (0x00000004)
Add this attribute to the Ambiguous Name Resolution (ANR) set. This is used to assist in finding an object when only partial information is given. For example, if the LDAP filter is (ANR=JEFF), the search will find each object where the first name, last name, email address, or other ANR attribute is equal to JEFF. Bit 0 must be set for this index take affect.
8 (0x00000008)
Preserve this attribute in the tombstone object for deleted objects.
16 (0x00000010)
Copy the value for this attribute when the object is copied.
32 (0x00000020)
Supported beginning with Windows Server 2003. Create a tuple index for the attribute. This will improve searches where the wildcard appears at the front of the search string. For example, (sn=*mith).
64(0x00000040)
Supported beginning with ADAM. Creates an index to greatly help VLV performance on arbitrary attributes.
To remove the PRESERVE_ON_DELETE flag, we subtracted 8 from customer's value of 31, which gave us a value of 23 (INDEX | CONTAINER | ANR | COPY).
Once we removed the PRESERVE_ON_DELETE flag, we created and deleted a test account to confirm our modifications changed the tombstone behavior of the userPrincipalName attribute. UPN was no longer maintained!
Mystery solved!! I think we all deserve a Scooby Snack now!
Nom nom nom!
This wraps up the "More than you really ever wanted to know about ADAMSync, ADRB & searchFlags" Scooby Doo edition of AskDS. Now, go enjoy your Scooby Snacks!
- Kim "That Meddling Kid" Nichols