Archive for the 'Microsoft Active Directory' Category

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!

Web Active Directory Releases Replacement for Microsoft IISADMPWD for Windows IIS7

We officially launched our Microsoft® IISADMPWD Replacement Tool today. Our simple solution addresses several issues with previous versions of IISADMPWD and allows you to delegate Windows password changes for web applications running on IIS 7 and later. At $599 USD, the new solution provides lots of value to allow users to self manage passwords for a small price. You can get more info about the solution at http://www.webactivedirectory.com/products/iisadmpwd/.

More Information

I have blogged about the need for an IISADMPWD replacement in the past and check out the articles below to learn more about why we built this solution for IIS 7.

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.

PowerShell Errors Connecting to Active Directory Domains and Forests

I needed to work with data from a child domain in our test environment so I tried to access the child domain using the Get-ADDomain cmdlet from the Active Directory module for PowerShell. When that operation failed, I attempted to map a PS drive to the child domain instead, but this operation failed as well. However, both the Get-ADDomain and New-PSDrive cmdlets work fine in the root domain of the forest.

I noted the following errors messages with each cmdlet and the New-PSDrive error message holds the key to solving the problem.

Get-ADDomain : Cannot find an object with identity: ‘child.root.local’ under: ‘DC=root,DC=local’.

New-PSDrive : Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running.

Resolution

The New-PSDrive error message best exposes the source of the problem. I know the server and domain exist so that’s not the problem. Instead, the Active Directory module cmdlets cannot contact the domain because it does not have at least one Windows Server 2008 R2 domain controller in the domain or at least one instance in an AD LDS configuration set that is running on a Windows Server 2008 R2 server.

Aha! My child domain does not have any Server 2008 R2 DCs or LDS instances. So how can I address this? There are a few options.

  1. Install the Active Directory Management Gateway Service on at least one non-2008 R2 domain controller, including Server 2003 and 2008. This provides a Web service interface to Active Directory domains and instances of Active Directory Lightweight Directory Services (AD LDS) or Active Directory Application Mode (ADAM) that are running on the same server as the Active Directory Management Gateway Service.
  2. Promote an existing Server 2008 R2 member server in the domain to a domain controller.
  3. Upgrade at least one DC in the domain to Server 2008 R2.

Active Directory Attributes for Remote Desktop Services

We are working with a customer who needs to set some values for the Remote Desktop Services (RDS) Profile (formerly Terminal Services) attributes in Active Directory. Even after working with AD and programming for it for more than 10 years, I’ve never had the need to access these attributes until now. Easy enough, right? We’ll just look up the attributes in the AD schema and be off and running.

Alas, it’s not that easy to set the Remote Desktop Services Profile attribute values in AD. All RDS parameters are stored in a BLOB (binary large object) in the Active Directory userParameters attribute. If you want to interact with this value directly through LDAP, you must decode and encode the attribute value to access the individual BLOB members that represent the values for the RDS Profile attributes. The encoding algorithm is a bit strange, though, and poorly documented. I found a fairly clear and precise reference for the BLOB encoding algorithm (ironically, for use by a Linux admin) and you can give it a try but there is a better option to interact with RDS profile attribute values if you have access to the COM API.

An article by Alejandro Campos Magencio does a nice job of spelling out the technical details needed to properly implement reading and writing RDS Profile attributes in AD. Microsoft added AD schema extensions in Server 2008 to support this need with the msTSProfilePath, msTSHomeDrive and msTSHomeDirectory attributes. At this point, though, these attributes aren’t being used and you still must rely upon the userParameters BLOB. The Tsuserex.dll library provides an ADSI (Active Directory Service Interfaces) extension that allows you to work with RDS profile values through the IADsTSUserEx interface. The interface implements properties including TerminalServicesHomeDirectory, TerminalServicesHomeDrive and TerminalServicesProfilePath that allow you to read and modify RSD profile values in the userParameters BLOB.

This should help you get started with an implementation. I will explore this subject more in a later post and provide some PowerShell and C# code to help illustrate how to read and write RDS profile attributes in AD.

Active Directory management built for MSPs

We have been getting a ton of traffic lately from MSPs that are becoming more and more frustrated with managing data and accounts in Active Directory and the operational costs associated with this menial task. Most of the administrators have been toying with the idea of actually creating their own web applications to delegate out to their customers, but cannot find the time.

The MSPs that do eventually break down and start looking for existing tools find them to be very complicated for their needs and are priced to meet enterprise needs and not theirs (a per-user model).

We have been hit over the head too many times to not make an attempt to satisfy MSP’s needs, so WebAD is now providing tools specific to the MSP market and priced at a low fixed monthly rate.

Call us to learn more about this offering for MSPs and let us show how we can meet the needs of Active Directory account and data management and meet your pricing expectations. You may also ask us how some MSPs are actually turning our tools into a revenue source as well!

Call me at +1 (800)747-3565 or email me at Steve.denney@webactivedirectory.com for more information.

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

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 243 other followers


Follow

Get every new post delivered to your Inbox.

Join 243 other followers