Posts Tagged 'AD'

Active Directory Management Gateway Service (ADMGS) Errors and McAfee Anti-Virus Software

I posted last month about an issue with the Active Directory Management Gateway Service (ADMGS) on Windows Server 2008. The ADMGS  (which runs as the Active Directory Web Services, ADWS, service) allows you to use the Active Directory module for Windows PowerShell to manage AD remotely in domains where there are no Server 2008 R2 domain controllers running.

I saw the following error messages when running the “import-module activedirectory” command in PowerShell.

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

I was able to diagnose the ultimate cause based on my previous post but still was receiving errors even after mucking with NTFS directory permissions for temporary .NET files. I finally had the idea to check on anti-virus software to see if that was blocking the communication. Wallah! The domain controller had anti-virus software installed (in this case it was McAfee) and as soon as I adjusted the AV software configuration the AD connection was allowed. The log entries below help pinpoint the cause.

1/19/2012        5:22:05 PM        Blocked by Access Protection rule         NT AUTHORITY\SYSTEM        C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe        C:\Windows\TEMP\t0sggpq5.dll        Common Maximum Protection:Prevent creation of new executable files in the Windows folder        Action blocked : Create

1/19/2012        5:22:07 PM        Would be blocked by Access Protection rule  (rule is currently not enforced)         NT_DOMAIN\SRS-RMRES2-02$        System:Remote        C:\Windows\SYSVOL\domain\Policies\{1C9122E4-78CD-4001-A2E7-8BBCA348C893}\GPT.INI        Anti-virus Outbreak Control:Block read and write access to all shares        Action blocked : Read

So make sure to check your AV software if you have this kind of problem…it just might be the key to a solution!

Diagnose Active Directory Management Gateway Service (ADMGS) Errors

I recently worked on a Windows Server 2008 system with the Active Directory Management Gateway Service (ADMGS) installed. The ADMGS allows you to use the Active Directory module for Windows PowerShell to manage AD remotely in domains where there are no Server 2008 R2 domain controllers running.

The ADMGS service (which runs as the Active Directory Web Services, ADWS, service) worked fine for several months but decided to begin having problems recently. We saw the following error message when running the “import-module activedirectory” command in PowerShell

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Needing to troubleshoot the source of the issue, I messed with the IncludeExceptionDetailInFaults attribute in the C:\Windows\ADWS\Microsoft.ActiveDirectory.WebServices.exe.config file. However, this proved to be a daunting task for a number of reasons so I moved on to another solution. (View an example of setting the IncludeExceptionDetailInFaults attribute.)

Finally, I located a post that helped break this open. Adding a couple of debug keys in the <AppSettings> section of the config file allowed me to log the ADMGS error on the server and diagnose the real source of the error.

<add key="DebugLevel" value="Info" />
<add key="DebugLogFile" value="C:\Windows\Debug\adws.log" />

Use the following valid string values (not numeric values) for the DebugLevel value.This will add diagnostic info into the debug log at the DebugLogFile path you specify.

  • 0 – No logging
  • 1 – Error (this logs critical errors only)
  • 2 – Warn (this logs warning events as well as error events) – Recommended value to use unless you need full tracing
  • 3 – Info (verbose)

Once I set up debugging and restarted the ADMGS service, I got to the bottom of the problem with the error below and I can now address the permissions issue that is causing connection problems with the “import-module activedirectory” PowerShell command.

ActiveDirectoryWebServices: [xx/xx/2011 6:14:15 PM] [3] Get: Unhandled Exception System.UnauthorizedAccessException: Access to the temp directory is denied. Identity 'YOUR_DOMAIN\YourAccount' under which XmlSerializer is running does not have sufficient permission to access the temp directory. CodeDom will use the user account the process is using to do the compilation, so if the user doesnt have access to system temp directory, you will not be able to compile. Use Path.GetTempPath() API to find out the temp directory location.

Binding to Active Directory: AD Connections De-mystified, Part 5

Note: This series covers Active Directory connection strings, often referred to as bind paths, with the goal of simplifying the process of creating an AD bind path. A significant amount of the information for this series comes from the wonderful AD programming book, The .NET Developer’s Guide to Directory Services Programming, by Ryan Dunn and Joe Kaplan. The LDAP ADsPath article on MSDN also provides good insight into creating valid bind paths for Active Directory.

Overview of Part 5

In Part 1 of this series, we examined the basics of Active Directory bind paths. In Part 2, we looked more deeply into the components of a bind path. In Part 3, we took apart the server name syntax and checked out serverless binding. In Part 4, we examined using distinguished names to connect to objects in Active Directory. In this final post of the series, we look at binding to Active Directory objects using GUIDs and SIDs.

Using GUIDs in Object Names

You can specify object names in Active Directory using a special GUID syntax in the following form. One very nice feature of binding using GUIDs is that the GUID stays the same for an object even when the object is renamed or moved across domains.

<GUID=guidvalue>

You must keep the angle brackets and GUID keyword to tell AD that you are binding using the GUID object name syntax. This refers to the objectGUID attribute for an object. The key here is to use correct form of the GUID since there are a couple of forms of GUIDs available based on legacy x86 details. If the GUID contains dashes, use the COM string format. Otherwise, use the binary octet string format.

An example of a GUID bind path follows.

LDAP://<GUID=ec2b2b8f-dcd5-41c3-aa9e-2e9d26e46a10>

You can also use GUIDs to access well-known objects in AD like the Users and Computers containers. Use the following form to define a well-known GUID bind path.

<WKGUID=Guid,Domain Partition DN>

In this format, the Guid is the GUID identifier (GUID_USERS_CONTAINER_W or GUID_COMPUTERS_CONTAINER_W, for example) and the Domain Partition DN is the DN of the root domain, for example DC=mydomain,DC=local. You may choose well-known GUIDs from the list below to access different well-known containers in Active Directory.

  • GUID_USERS_CONTAINER_W: Users container
  • GUID_COMPUTERS_CONTAINER_W: Computers container
  • GUID_SYSTEMS_CONTAINER_W: Systems container
  • GUID_DOMAIN_CONTROLLERS_CONTAINER_W: Domain Controllers container
  • GUID_INFRASTRUCTURE_CONTAINER_W: Infrastructure container
  • GUID_DELETED_OBJECTS_CONTAINER_W:  Deleted Objects container
  • GUID_LOST_AND_fOUND_CONTAINER_W:  Lost and Foundcontainer

Check out the example of a well-known GUID bind path that connects to the Users container in the mydomain.local domain.

LDAP://<WKGUID=GUID_USERS_CONTAINER_W,DC=mydomain,DC=com>

Using SIDs in Object Names

Finally, AD allows you to bind to an object name by an object’s SID. Not all objects in AD have SIDs so make sure you only try to bind by SID to objects that are security principals, including user accounts, groups and computers. Also be aware that SIDs can change as objects move across domains but you can always look up previous SIDs after changes using the sidHistory attribute.

Use the following syntax to bind to an object by its SID.

<SID=sidvalue>

Here, the sidvalue can support either a hexadecimal octet string or the Security Descriptor Description Language (SDDL) format that looks like S-1-5-xxxx. Be careful to use the SDDL format with Windows Server 2003 AD and later since Windows 2000 only supports the octet string syntax. Also remember that since SIDs can change from domain to domain, you cannot use a global catalog (GC) bind to a global catalog server or you will get an error.

The follow example shows a SID bind using the SDDL format.

LDAP://<SID=S-1-5-21-1720926295-173614409-390823645-1127>

Binding to Active Directory: AD Connections De-mystified, Part 4

Note: This series covers Active Directory connection strings, often referred to as bind paths, with the goal of simplifying the process of creating an AD bind path. A significant amount of the information for this series comes from the wonderful AD programming book, The .NET Developer’s Guide to Directory Services Programming, by Ryan Dunn and Joe Kaplan. The LDAP ADsPath article on MSDN also provides good insight into creating valid bind paths for Active Directory.

Overview of Part 4

In Part 1 of this series, we examined the basics of Active Directory bind paths. In Part 2, we looked more deeply into the components of a bind path. In Part 3, we took apart the server name syntax and checked out serverless binding. In this article, we examine using distinguished names to connect to objects in Active Directory.

What is a Distinguished Name?

Active Directory uses a distinguished names (DN) as a path to uniquely identify an object in the directory. You can use a DN to hook to OU containers, user accounts, groups, schema objects and anything else stored in AD. Since AD is an LDAP directory, it stores objects in a hierarchical tree like a filesystem and you can use DNs as a sort of path syntax to hook into an object.

DN Path Syntax

DNs use a syntax similar to a filesystem path as each piece of the DN is more specific to where the object resides in the directory. Look at the following example of a DN.

CN=Test User,OU=UserContainer,DC=mydomain,DC=local

In this example, we have four components of the path, each separated by a comma. You read the DN from left to right where the leftmost component is the most specific node in the directory tree and specifies the object identified by the DN. In this case, that object is a user account with the common name (CN) of Test User.

Working to the right, we see that the Test User account is in an organizational unit (OU) called UserContainer. This container is a child of the root of the namespace, mydomain.local.

Finally, the namespace root of mydomain.local is specified by the last two components, DC=mydomain,DC=local. Technically, both the domain component (DC) values here are actually part of the same component as the combination of the two specifies the root of the namespace. In general, just remember that when you use the DNS name of a domain or forest in a DN, you need to add a “DC=” for each part of the DNS name when creating the DN.

Special DN Characters

DNs are very powerful for addressing objects in AD but sometimes you have to be careful if a directory has containers or objects that contain special characters. The following characters are reserved in AD and cannot be included in a DN unless they are escaped with the \ character.

<,;+\/">

You also must escape the # character if it is the first character in a DN. When using any special reserved characters in a DN, you must escape them using the \ character. Note that spaces in a name do not need to be escaped.

Binding to Active Directory: AD Connections De-mystified, Part 3

Note: This series covers Active Directory connection strings, often referred to as bind paths, with the goal of simplifying the process of creating an AD bind path. A significant amount of the information for this series comes from the wonderful AD programming book, The .NET Developer’s Guide to Directory Services Programming, by Ryan Dunn and Joe Kaplan. The LDAP ADsPath article on MSDN also provides good insight into creating valid bind paths for Active Directory.

Overview of Part 3

In Part 1 of this series, we examined the basics of Active Directory bind paths. In Part 2, we looked more deeply into the components of a bind path. In this post, we dive even deeper into the bind path as we look closely at the server name syntax and serverless binding.

Server Names vs. Serverless Binding in Active Directory Bind Paths

When creating an AD bind path, you can specify an optional server name as part of your bind path or you can use a technique called serverless binding to select any available domain controller in the local site. In general, you should use serverless binding but there are scenarios where you need to specify a server name and we examine those scenarios before moving on to serverless binding.

Server Names

You can use a number of formats for an AD bind path, including DNS-style names, NetBIOS names and IP addresses. In addition to these names, you can specify a connection port if necessary.

DNS-style names allow you to connect using any of the following formats.

  • Fully-qualified domain name (FQDN) of a domain controller or global catalog server
  • FQDN of a domain or forest
  • Unqualified name (short form without full DNS name) of a domain or forest

You can also use the NetBIOS name of a domain, domain controller or global catalog server to connect, depending on your network configuration. Finally, the IP address allows you to bind to a specific server as well.

Server Port Numbers

If you use the default LDAP and GC providers on ports 389 and 3268 (or 636 and 3269 for SSL) then you do not need to specify a port number with either provider. If you need to connect to a non-standard port, then you can add the port number to the server name after a colon as in the following example.

LDAP://mydomain.local:12345

Most times you do not need to specify a port number, though.

Serverless Binding in Active Directory

Active Directory supports a technique called serverless binding that allows you to connect to any available domain controller in the local AD site. This best practices technique allows you to provide better fault tolerance by connecting to a range of servers while reducing the load on a particular server.

To use a serverless bind, simply do not specify a server in your bind path. Yep, it’s that easy! You can still put in the provider and object name but leave the server portion blank as in the following example.

LDAP://CN=Users,DC=mydomain,DC=local

Under the covers, a serverless bind uses the domain of the current security context running the application and then uses the Windows Locator service and DNS to look up available domain controllers in the site. As long as you are running the application under a domain account, the serverless bind technique works well. You can incur a COM exception of 0x8007203A, though, if you run under a local machine account since machine accounts are not members of a domain.

Server Name Best Practices

So when it’s all said and done, you should use one of the following techniques for the most fault tolerant, robust and scalable applications that connect to AD.

  1. Use serverless binding if running under a domain account and connecting to AD in the same site as the domain account.
  2. Specify a DNS name for the domain or forest—but not a specific domain controller or global catalog server—if connecting to a different domain or forest or if the application runs under a local machine account.

Binding to Active Directory: AD Connections De-mystified, Part 2

Note: This series covers Active Directory connection strings, often referred to as bind paths, with the goal of simplifying the process of creating an AD bind path. A significant amount of the information for this series comes from the wonderful AD programming book, The .NET Developer’s Guide to Directory Services Programming, by Ryan Dunn and Joe Kaplan. The LDAP ADsPath article on MSDN also provides good insight into creating valid bind paths for Active Directory.

Overview of Part 2

In Part 1 of this series, we examined the basics of Active Directory bind paths. We look more deeply into the components of a bind path in this post, including how to set the provider, server and object name for a bind path.

Bind Path Review

As we discussed in Part 1, bind paths use the ADsPath syntax to connect to objects in Active Directory. AD binds paths can include up to three parts.

  1. Provider: Specifies the ADSI provider to use to connect to a directory
  2. Server: AD server to use for a connection
  3. Object name: Directory object to reference

A bind path looks much like a URI instance.

<provider>://<server>/<object name>

Setting a Provider for a Bind Path

The bind path provider specifies the ADSI provider used to service an Active Directory bind request. When connecting to AD through ADSI, you have several options for providers but most often will use the LDAP provider. You can also use the Global Catalog provider, GC, to connect to a global catalog server and bind to objects across an entire forest. Both the LDAP and GC providers instruct ADSI to use the LDAP protocol to connect to AD using ports 369 and 3268, respectively, and you do not have to set these ports in your bind path.

You can bind to a number of other providers through ADSI. Additional providers include WinNT (to communicate with Windows NT 4.0 domain controllers), NDS (to communicate with Novell Directory Services servers), NWCOMPAT (to access Novell NetWare servers) and ADs (to enumerate all of the ADSI providers installed on a client).

Make sure you specify the provider with the proper upper- and lower-casing because ADSI providers are case sensitive. In the case of the LDAP and GC providers, each must be specified with capital letters. We see many instances where someone puts together a well-formed, valid bind path only to find it does not work because the provider casing is not correct. Many times you receive a COM error of “0×80005000 Unknown error” when binding with a provider that has incorrect casing.

Specifying Servers and Host Names

As part of a bind path, you can specify an optional server to tell ADSI exactly which server to use for a bind request to Active Directory. Many times, bind paths do not require a server and we will discuss the concept of serverless binding in a later post in the series.

If you do want to connect to a specific server, perhaps a server in a different domain or forest, you can specify the server name and optional port number in the following form.

LDAP://myservername:4500

You have a ton of options when setting the server name in the bind path, including using DNS-style names, NetBIOS names and IP addresses. In general, it is best practice to use serverless binding without a server name or to use the fully-qualified domain name (FQDN) to bind. You can specify server names for domains, specific domain controllers, forests and specific global catalog servers. We recommend that you specify domains and forests in the server portion of your bind string as this approach uses DNS to locate domain controllers and global catalog servers and provides much better fault tolerance than binding to an individual server.

Binding to the Object of Your Desire

Finally, you can specify an optional object to which to bind when you create a bind path. ADSI supports a number of options in how you specify an object, including using distinguished names, GUIDs and SIDs. We focus on the distinguished name syntax for this article and will look more deeply into other options in later posts in the series.

The distinguished name, or DN, for an object specifies the unambiguous path to the object in the directory. DNs act like a type of primary key and provide a great way to get a hook to anything in AD, including individual objects like user accounts and groups as well as containers like OUs. LDAP uses DNs extensively and you can refer to this great article from IBM for in-depth information about DNs and DN syntax.

I’m including a few examples below to show different object bind paths using different DNs. The first example binds to a user account called Jiminy Christmas that resides in the Some Users organizational unit (OU) in Active Directory. Note how the DNS namespace is added to the DN using the DC (domain component) of DC=mydomain,DC=local.

The second example is similar to the first but binds to the Some Users OU itself instead of an individual user account in that OU.

Finally, the last example specifies a server for another forest with a Global Catalog (GC) provider and binds to the Test Object in that forest.

LDAP://CN=Jiminy Christmas,OU=Some Users,DC=mydomain,DC=local
LDAP://mydomain.local/OU=Some Users,DC=mydomain,DC=local
GC://someotherforest.local/CN=Test Object,CN=Users,DC=someotherforest,DC=local

Binding to Active Directory: AD Connections De-mystified, Part 1

Note: This series covers Active Directory connection strings, often referred to as bind paths, with the goal of simplifying the process of creating an AD bind path. A significant amount of the information for this series comes from the wonderful AD programming book, The .NET Developer’s Guide to Directory Services Programming, by Ryan Dunn and Joe Kaplan. The LDAP ADsPath article on MSDN also provides good insight into creating valid bind paths for Active Directory.

Introduction

Many Active Directory-enabled applications, including our suite of AD management products, require you to specify a directory connection string to connect to an Active Directory instance. Confusion surrounds how to form a proper connection string, though, since many administrators rarely have to decompose a string or understand a string’s components.

We examine Active Directory connection strings in this series of articles with the goal of simplifying the process of creating a connection string. You have many options when connecting to Active Directory—connecting to a domain root, connecting to a whole forest or just getting a hook to one container object. This article series will explain each option with the goal of empowering you to build your own connection strings that do exactly what you need.

Please note that a significant amount of the information in this series comes from the wonderful AD programming book, The .NET Developer’s Guide to Directory Services Programming, by Ryan Dunn and Joe Kaplan. This 2006 book provides guidance for many AD programming needs and, although the book is now somewhat dated with the advent of a number of new namespaces in the .NET framework, the fundamentals like connecting to AD are still valid.

The Basics

Under the covers, Active Directory implements LDAP (Lightweight Directory Access Protocol) and much of the process of creating valid Active Directory connection strings involves understanding some LDAP basics. Active Directory does have subtle differences from LDAP implementations, though in the end the outcome is the same. I will highlight the differences if they are important but for the most part will concentrate on AD-specific implementation details.

Binding to AD

When connecting to Active Directory, we many times borrow the term “bind” from the LDAP world to describe the process of connecting to AD and operating on it in some way. Essentially, the process of binding to AD includes establishing a network connection to the directory and then obtaining a hook to some object in the directory. I will generally use the term “bind” from here out to describe the process of connecting to AD.

AD Path Syntax

The syntax you use to create a connection string, or path, to bind to AD is very important. Since bind paths actually use the ADSI (Active Directory Services Interfaces) ADsPath syntax to connect to AD objects, you must use this syntax. Although many options are available in the path, each path can include up to three parts.

  1. Provider: Specifies the ADSI provider to use to connect to a directory
  2. Server: AD server to use for a connection
  3. Object name: Directory object to reference

The generic form of the path follows and looks much like a URI instance.

<provider>://<server>/<object name>

Examples

A few examples help illustrate the different capabilities when binding to Active Directory.

LDAP://mydomain.local
LDAP://CN=My Object Name,CN=Users,DC=mydomain,DC=local
GC://myforest.local

In Part 2, we will look in more detail at bind paths and the rules around each part, the provider, server and object name.

Active Directory Provisioning with PowerShell: Extensibility and Power without Costly Implementation (Part 1 of 4)

Too often, software companies want absolute control of their black box of intellectual property (IP). These companies only want extensibility and customizability if it means more revenue from implementation services. A few companies in our space have even developed their own scripting languages to make customers pay for more services or training to learn yet another proprietary language technology.

We take a much different approach in our software efforts. Our new platform leverages Microsoft’s PowerShell technology to empower system engineers and administrators to extend applications using technology they already understand. We want to keep our solutions easy to deploy, a cinch to maintain and a snap to extend to meet new and ever-changing business needs. While other software companies catch the fish for you and then sell them at a costly markup we prefer to teach you to fish using a platform that you know and use on a regular basis.

PeopleProvision—WebAD’s first application built on our new PowerShell-enabled platform—allows you to delegate and automate Active Directory account and Exchange mailbox creation. PowerShell provides the heavy lifting and you get the benefit of access to the PowerShell source code so you can extend PeopleProvision’s behavior to meet the business requirements of your organization.

Over the next three blog posts, we will examine how PeopleProvision and its accompanying PowerShell toolkit empower you to take control of your provisioning and de-provisioning processes with a minimum of costly software licensing and implementation costs. We look at the PeopleProvision solution itself in more detail in Part 2 tomorrow and then delve into the secrets of a small implementation in Part 3 the next day. Finally, we teach you to fish in Part 4 by linking the PowerShell specifics to the PeopleProvision front end.

Join us for our journey through PeopleProvision and learn how you can automate and delegate your account provisioning and de-provisioning at an affordable cost of money, time and effort.

Presentation Links: Free Active Directory Tools and Tips

WebAD is presenting today at the 17th Annual Technology Planning Conference for Region 10 of the Texas Education Service Center (ESC) in Richardson, Texas. The presentation highlights free tools and technologies that can help K-12 school districts manage their Active Directory environment, especially the automated creation, moving and deletion of student user accounts. Check out the notes below for additional resources for managing AD.

Active Directory Lifecycle Management: A practical guide to automating maintenance of your Active Directory environment

 Learn how to use free tools and technologies for common Active Directory management tasks. Automate account creation, bulk data updates and account deletion to synchronize AD data with your Student Information System. Employ free tools and technologies including CSVDE, LDIFDE and PowerShell to ease the burden of administration on your technology shop.

Tools

Introduction to CSVDE and LDIFDE

http://www.computerperformance.co.uk/Logon/CSVDE_LDIFDE.htm

Introduction to CSVDE

http://www.computerperformance.co.uk/Logon/Logon_CSVDE.htm

Ldifde

http://technet.microsoft.com/en-us/library/cc731033(v=ws.10).asp

Csvde

http://technet.microsoft.com/en-us/library/cc732101(v=ws.10).asp

Dsmod

http://technet.microsoft.com/en-us/library/cc732406(WS.10).aspx

Active Directory Explorer v1.42

http://technet.microsoft.com/en-us/sysinternals/bb96390

ADSI Edit (adsiedit.msc)

http://technet.microsoft.com/en-us/library/cc773354(WS.10).aspx

Ldp Overview

http://technet.microsoft.com/en-us/library/cc772839(WS.10).aspx

Using Ldp.exe to Find Data in the Active Directory

http://support.microsoft.com/kb/224543

Windows Server 2003 – LDP Support Tool Utility

http://www.computerperformance.co.uk/w2k3/utilities/ldp.htm

LDP.exe | Query Active Directory Tool

http://activedirectorytools.net/ldp-exe-query-active-directory-tool

PowerShell downloads

http://technet.microsoft.com/en-us/scriptcenter/dd772288

Scripting for Active Directory

http://technet.microsoft.com/en-us/scriptcenter/dd793613.aspx

PowerShell Scripting Tools

Welcome to PowerGUI.org – a free community for PowerGUI, a graphical user interface and script editor for Microsoft Windows PowerShell!

http://powergui.org/index.jspa

Introducing the Windows PowerShell ISE

http://technet.microsoft.com/en-us/library/dd315244.aspx

Procedures

Using LDIFDE to import and export directory objects to Active Directory

http://support.microsoft.com/kb/237677

How to use Csvde to import contacts and user objects into Active Directory

http://support.microsoft.com/kb/327620

Step-by-Step Guide to Bulk Import and Export to Active Directory

http://technet.microsoft.com/en-us/library/bb727091.aspx

Resources

Windows PowerShell Blog

http://blogs.msdn.com/b/powershell/

Windows PowerShell Owner’s Manual

http://technet.microsoft.com/en-us/scriptcenter/ee221100

PowerShell Scripts, Tips, Expert Advice & Training, Forums, and Resources

http://powershell.com/cs/

PowerShell Pro!

Tutorials and educational resources like a script library, esp. for AD management.

http://www.powershellpro.com/

General AD

LDAP Query Basics

http://technet.microsoft.com/en-us/library/aa996205(EXCHG.65).aspx

Search Filter Syntax

http://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx

Binding to Active Directory Domain Services

http://msdn.microsoft.com/en-us/library/aa772152.aspx

LDAP ADsPath

http://msdn.microsoft.com/en-us/library/aa746384.aspx

Active Directory

http://en.wikipedia.org/wiki/Active_Directory

About Active Directory Domain Services

http://msdn.microsoft.com/en-us/library/aa772142(v=VS.85).aspx

Active Directory

http://technet.microsoft.com/en-us/library/bb742424.aspx

Active Directory Administrative Center: Getting Started

http://technet.microsoft.com/en-us/library/dd560651(WS.10).aspx

How Active Directory Calculates Account Password Expiration Dates

It’s common to want to retrieve password expiration dates for users by querying Active Directory directly. Conversely, you might want to obtain a list of all users whose passwords will expire soon. Of course, you cannot use Active Directory Users & Computers to view the password expiration value and tools like ADSI Edit can only display data that is in AD. Since the password expiration date for a user is calculated and not stored directly in AD, you have to take a different approach to make this work.

Active Directory calculates password expiration by reading the date when a user’s password was last changed (using the pwdLastSet attribute) and then reading the password policy (for the domain or AD container, depending on your AD functional level) for the account to determine the maximum password age. These two values are added to determine the password expiration value.

password change date + password policy maximum password age = password expiration date

Sounds easy enough, eh? The calculation is easy. What’s not easy is getting the values for the password change date (pwdLastSet) and the policy maximum password age (maxPwdAge). These values are stored internally in AD as LargeInteger, an 8-byte integer value. Your calculation needs to convert these internal data types for comparison to human-readable dates. Fortunately, there are easy conversion methods for converting these data types and the code samples at the end of this article show you these methods.

Web Active Directory provides PeopleMinder, a simple-to-deply solution to send notifications to users with expiring passwords, and this solution uses the password expiration calculation at its core to search for these users. You should check out PeopleMinder if you want a robust method to send out password expiration reminders on a daily basis.

Code Samples

Check out the code samples linked below for more information about calculating the AD password expiration date. You can then use these calculations to search for users whose passwords will expire soon. If you are a .NET developer, the Directory Programming .NET site at http://directoryprogramming.net/ is a fantastic resource for writing this type of password expiration date code. In fact, the site is a fantastic resource for all types of AD management code.

Scripts

PowerShell

.NET

Next Page »


Slipstick Systems Outlook and Exchange Solutions Center
Utilities, how to's and other solutions for Microsoft Outlook and Microsoft Exchange users, administrators and developers

Share this blog

Facebook Twitter More...

Enter your email address to subscribe to WebActiveDirectory blog via email.

Join 33 other followers