O'Reilly logo

Active Directory Cookbook, 3rd Edition by Robbie Allen, Laura E. Hunter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Preface

In 1998, when Robbie first became involved with the Microsoft Windows 2000 Joint Development Program (JDP), there was very little data available on Active Directory (AD). In the following months and even after the initial release of Windows 2000, there were very few books or white papers to help early adopters of Active Directory get started. And some of the information that had been published was often inaccurate or misleading. Many early adopters had to learn by trial and error. As time passed, more and more informative books were published, which helped fill the information gap.

By the end of the second year of its release, there was an explosion of information on Active Directory. Not only were there more than 50 books published, but Microsoft also cleaned up their documentation on MSDN (http://msdn.microsoft.com) and their AD website (http://www.microsoft.com/ad). Now those sites have numerous white papers, many of which could serve as mini booklets. Other websites have popped up as well that contain a great deal of information on Active Directory. With Windows Server 2003 and Windows Server 2008, Microsoft has taken their level of documentation a step higher. Extensive information on Active Directory is available directly from any Windows Server 2003 or 2008 computer in the form of the Help and Support Center (available from the Start Menu). So with all this data available on Active Directory in the form of published books, white papers, websites, and even from within the operating system, why would you want to purchase this one?

In the summer of 2002, Robbie was thumbing through Tom Christiansen and Nathan Torkington’s Perl Cookbook from O’Reilly, looking for help with an automation script that he was writing for Active Directory. It just so happened that there was a recipe that addressed the specific task he was trying to perform. In Cookbook parlance, a recipe provides instructions on how to solve a particular problem. We thought that since Active Directory is such a task-oriented environment, the Cookbook approach might be a very good format. After a little research, Robbie found there were books (often multiple) on nearly every facet of Active Directory, including introductory books, design guides, books that focused on migration, programming books, and reference books. The one type of book that he didn’t see was a task-oriented “how to” book, which is exactly what the Cookbook format provides. With this was born the first edition of Active Directory Cookbook, covering Active Directory tasks in Windows 2000 and Windows Server 2003 Active Directory.

In 2005, Laura E. Hunter revised the already popular Active Directory Cookbook to include an updated range of automation options, including the use of command-line tools and scripts that had been created by active members of the Directory Services community in the years since AD was first introduced.

Based on our experience, hours of research, and nearly a decade of hanging out on Active Directory newsgroups and mailing lists, we’ve compiled more than 500 recipes that should answer the majority of “How do I do X?” questions one could pose about Active Directory. And just as in the Perl community, where the Perl Cookbook was a great addition that sells well even today, we believe Active Directory Cookbook, Third Edition, will also be a great addition to any Active Directory library.

1. Who Should Read This Book?

As with many of the books in the Cookbook series, Active Directory Cookbook, Third Edition, can be useful to anyone who wants to deploy, administer, or automate Active Directory. This book can serve as a great reference for those who have to work with Active Directory on a day-to-day basis. For those without much programming background, the command-line, VBScript, and PowerShell solutions are straightforward and provide an easy way to automate repetitive administrative tasks for any administrator.

The companion to this book, Active Directory, Fourth Edition, by Brian Desmond et al. (O’Reilly), is a great choice for those wanting a thorough description of the core concepts behind Active Directory, how to design an Active Directory infrastructure, and how to automate that infrastructure using Active Directory Service Interfaces (ADSI) and Windows Management Instrumentation (WMI). Active Directory, Fourth Edition, does not necessarily detail the steps needed to accomplish every possible task within Active Directory; that is more the intended purpose of this book. These two books, along with the supplemental information referenced within each, should be sufficient to answer most questions you have about Active Directory.

2. What’s in This Book?

This book consists of 21 chapters. Here is a brief overview of each chapter:

Chapter 1, Getting Started

Sets the stage for the book by covering where you can find the tools used in the book, VBScript and PowerShell issues to consider, and where to find additional information.

Chapter 2, Forests, Domains, and Trusts

Covers how to create and remove forests and domains, update the domain mode or functional levels, create different types of trusts, and other administrative trust tasks.

Chapter 3, Domain Controllers, Global Catalogs, and FSMOs

Covers promoting and demoting domain controllers, finding domain controllers, enabling the global catalog, and finding and managing Flexible Single Master Operations (FSMO) roles. This will include coverage of the new Read-Only Domain Controller (RODC) that was introduced with Windows Server 2008.

Chapter 4, Searching and Manipulating Objects

Covers the basics of searching Active Directory: creating, modifying, and deleting objects, using LDAP controls, and importing and exporting data using LDAP Data Interchange Format (LDIF) and comma-separated variable (CSV) files.

Chapter 5, Organizational Units

Covers creating, moving, and deleting Organizational Units, and managing the objects contained within them.

Chapter 6, Users

Covers all aspects of managing user objects, including creating, renaming, moving, resetting passwords, unlocking, modifying the profile attributes, and locating users that have certain criteria (e.g., password is about to expire). This chapter includes coverage of the new Fine-Grained Password Policy feature that was introduced in Windows Server 2008.

Chapter 7, Groups

Covers how to create groups, modify group scope and type, and manage membership.

Chapter 8, Computer Objects

Covers creating computers, joining computers to a domain, resetting computers, and locating computers that match certain criteria (e.g., have been inactive for a number of weeks).

Chapter 9, Group Policy Objects

Covers how to create, modify, link, copy, import, back up, restore, and delete GPOs using the Group Policy Management Console and scripting interface, including new Group Policy features that were introduced in Windows Server 2008.

Chapter 10, Schema

Covers basic schema administration tasks, such as generating object identifiers (OIDs) and schemaIDGUIDs, how to use LDIF to extend the schema, and how to locate attributes or classes that match certain criteria (e.g., all attributes that are indexed).

Chapter 11, Site Topology

Covers how to manage sites, subnets, site links, and connection objects.

Chapter 12, Replication

Covers how to trigger and disable the Knowledge Consistency Checker (KCC), how to query metadata, force replication, and determine what changes have yet to replicate between domain controllers.

Chapter 13, DNS and DHCP

Covers creating zones and resource records, modifying DNS server configuration, querying DNS, and customizing the resource records a domain controller dynamically registers.

Chapter 14, Security and Authentication

Covers how to delegate control, view and modify permissions, view effective permissions, and manage Kerberos tickets.

Chapter 15, Logging, Monitoring, and Quotas

Covers how to enable auditing, diagnostics, DNS, NetLogon, and Kerberos and GPO logging; obtain LDAP query statistics; and manage quotas.

Chapter 16, Backup, Recovery, DIT Maintenance, and Deleted Objects

Covers how to back up Active Directory, perform authoritative and nonauthoritative restores, check DIT file integrity, perform online and offline defrags, and search for deleted objects.

Chapter 17, Application Partitions

Covers creating and managing application partitions.

Chapter 18, Active Directory Application Mode and Active Directory Lightweight Directory Service

Covers the new Active Directory Application Mode (ADAM) functionality that’s available with R2.

Chapter 19, Active Directory Federation Services

Covers the new Active Directory Federation Services (AD FS) that are included with Windows Server 2003 R2.

Chapter 20, Microsoft Exchange Server 2007 and Exchange Server 2003

Covers common administrative tasks for Exchange Server 2003.

Chapter 21, Microsoft Identity Lifecycle Manager

Provides an introduction to Microsoft’s Identity Integration Server (MIIS), a service that can be used to synchronize multiple directories or enforce data integrity within a single or multiple stores.

3. Conventions Used in This Book

The following typographical conventions are used in this book:

Constant width

Indicates classes, attributes, cmdlets, methods, objects, command-line elements, computer output, and code examples.

Constant width italic

Indicates placeholders (for which you substitute an actual name) in examples and in registry keys.

Constant width bold

Indicates user input.

Italic

Introduces new terms and example URLs, commands, file extensions, filenames, directory or folder names, and UNC pathnames.

Note

Indicates a tip, suggestion, or general note. For example, we’ll tell you if you need to use a particular version or if an operation requires certain privileges.

Warning

Indicates a warning or caution. For example, we’ll tell you if Active Directory does not behave as you’d expect or if a particular operation has a negative impact on performance.

4. Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: Active Directory Cookbook, Third Edition, by Laura E. Hunter and Robbie Allen. Copyright 2009 O’Reilly Media, Inc., 978-0-596-52110-3.

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Note

When you see a Safari® Books Online icon on the cover of your favorite technology book, that means the book is available online through the O’Reilly Network Safari Bookshelf.

Safari offers a solution that’s better than e-books. It’s a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it for free at http://safari.oreilly.com.

5. We’d Like Your Feedback!

We at O’Reilly have tested and verified the information in this book to the best of our ability, but mistakes and oversights do occur. Please let us know about errors you may find, as well as your suggestions for future editions, by writing to:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the U.S. or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for the book where we list errata, examples, or any additional information. You can access this page at:

http://www.oreilly.com/catalog/9780596521103

To comment or ask technical questions about this book, send email to:

For more information about our books, conferences, software, Resource Centers, and the O’Reilly Network, see our website at:

http://www.oreilly.com

6. Acknowledgments

Robbie Allen, from the First Edition

The people at O’Reilly were a joy to work with. I would like to thank Robert Denn for helping me get this book off the ground. I am especially grateful for Andy Oram’s insightful and thought-provoking feedback.

I was very fortunate to have an all-star group of technical reviewers. If there was ever a need to assemble a panel of the top Active Directory experts, you would be hard-pressed to find a more knowledgeable group of guys. Here they are in alphabetical order.

Rick Kingslan is a senior systems engineer and Microsoft Windows Server MVP. If you’ve ever posted a question to an Active Directory newsgroup or discussion forum, odds are Rick participated in the thread. His uncanny ability to provide useful feedback on just about any Active Directory problem helped ensure I covered all the angles with each recipe.

Gil Kirkpatrick is the executive vice president and CTO of NetPro (http://www.netpro.com). Gil is also the author of Active Directory Programming from MacMillan. His extensive knowledge of the underpinnings of Active Directory helped clarify several issues I did not address adequately the first time through.

Tony Murray is the maintainer of the website and mailing list, which is one of the premier Active Directory discussion forums. The myriad of questions posed to the list served as inspiration for this book. Tony’s comments and suggestions throughout the book helped tremendously.

Todd Myrick has a unique perspective on Active Directory from his experience inside the government. Todd contributed several outside-the-box ideas to the book that only a creative person, such as he, could have done.

joe Richards is the creator of the http://www.joeware.net website, which contains many must-have Active Directory tools, such as AdFind, Unlock, and many more. joe is one of the most experienced Active Directory administrators and programmers I’ve met. He’s had to do most of the tasks in this book at one point or another, so his contributions were significant.

Kevin Sullivan is the project manager for Enterprise Directory Management at Aelita. Kevin has as much experience with Active Directory as anyone you’ll find. He is a frequent contributor to Active Directory discussion forums, and he provided numerous suggestions and clarifications throughout the book.

Last, but certainly not least, I would like to thank my wife, Janet. Her love, support, and bright smile are constant reminders of how lucky I am. Did I mention she cooks, too?!

Laura E. Hunter, from the Second Edition

Like Robbie, I find that the O’Reilly staff always manages to make the writing and reviewing process a smooth one, and this project was no exception. I’d like to thank Robbie himself for tapping me to update this wonderful book to the second edition. The original incarnation of Active Directory Cookbook remains one of the most well-read books on my AD bookshelf, so undertaking this project with Robbie was quite exciting.

I’d also like to thank Robbie for assembling yet another team of amazing technical reviewers, a number of whom have made a return engagement from reviewing the first edition of the book: Robert Buike, Rick Kingslan, Al Mulnick, Tony Murray, and joe Richards.

Throughout the writing and editing process, my technical reviewers have helped me, challenged me, encouraged me, kept me honest, and occasionally even made me laugh out loud (which is quite a blessing when you’re plugging away at an extensive project such as this one). I can’t imagine completing this project without their advice, assistance, and input.

In addition to my technical reviewers, I would like to thank Brian Puhl of Microsoft for his assistance with the AD FS chapter, Gil Kirkpatrick of NetPro and Steven Plank of Microsoft for their outstanding work on the MIIS content, and Dean Wells of MSE Technology for being a generally outstanding resource for all things Active Directory. (He’s not half bad at karaoke, either.)

Finally, many thanks are due to my family for tolerating the continuous game of “Where’s Laura?” during the weeks that I hid away in my office to complete this project, as well as my extended family within the Microsoft MVP program: Mark Arnold, Suzanna Moran (my running buddy from 3,000 miles away), Rafael Munoz, Sean O’Driscoll, Susan Leiter, Thomas Lee, Jimmy Andersson, Don Wells, Gary Wilson, Stuart Kwan, and Candice Pedersen.

Laura E. Hunter, from the Third Edition

I am simply thrilled to make a return engagement on the third edition of my all-time favorite book project, Active Directory Cookbook. A project as extensive as this one is never undertaken alone, and the staff at O’Reilly have once again stepped up to the plate to assist in every way.

Again as with the second edition, I have been blessed with fantastic technical reviewers who have made this as much a labor of love as I have: joe Richards of Hewlett-Packard and http://www.joeware.net fame (who has now tech-reviewed every single edition of this book), and Michael B. Smith of Smith Consulting. This book also would not have been possible without the valued contributions of Brad Turner of Ensynch for his Identity Lifecycle Manager expertise, and William Lefkowicz for his update of the Exchange chapter. Additionally, I am immensely grateful for the time and assistance of various brilliant members of the Directory Services community, including (but certainly not limited to) Dean Wells, Ulf B. Simon-Weidner, Gil Kirkpatrick, Brian Desmond, Jorge de Almeida-Pinto, Brian Puhl, Nathan Muggli, Stuart Kwan and Matt Steele. I must also particularly note the assistance of Brandon Shell, PowerShell MVP, for his unending attempts to get me to “drink the Powershell Kool-Aid” throughout my work on this latest edition of Active Directory Cookbook.

And as always, much thanks and love are due to my friends and family for their unflagging support (and amused tolerance) of my workaholic tendencies: in particular my mother, Carol; father, Charles; and my wonderful husband, Mark Arnold.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required