Odd characters appear in OU name, for no apparent reason

Discussion in 'Active Directory' started by Tom Schulte, Jun 21, 2007.

  1. Tom Schulte

    Tom Schulte Guest

    I am using C# to automate creating new Organizational Units and Groups. Twice
    we have attempted to create an OU with the name "651" and ended up with one
    named "651" followed by an apparent new line and then what looks like a GUID.
    It is no the object GUID. In interative testing we even ended up with our
    expected "651" OU, then the mis-named one and both having below them a
    "651.Everyone" group of the exact same name(!). That was unsettling.

    Starting with a DirectoryEntry at rootDSE, the core C# code is this:
    ....
    try
    {
    new_de = de.Children.Add("OU=" + nameOrganizationalUnit,
    "OrganizationalUnit");
    if (description != "")
    {
    new_de.Properties["description"].Add(description);
    }
    new_de.CommitChanges();
    }
    catch (System.DirectoryServices.DirectoryServicesCOMException se)
    ....

    Where nameOrganizationalUnit is hardcoded as "651" in all our testing. The
    mis-name shows up in the "name" attribute of the OU and on the property
    dialoged. I place a screen image of this dialog at:

    http://www.outsight.mu/art/ad.gif

    has anyone seen anything like this? No exceptions are thrown and all other
    processing attempted, such as affecting ACEs, setting properties, etc.
    happens successfully and accurately
     
    Tom Schulte, Jun 21, 2007
    #1
    1. Advertisements


  2. Just a guess, but AD might be fooled if the value of nameOrganizationalUnit
    is interpreted as an Integer, especially when the "+" seems to be adding a
    value to it. I would use "&" in place of "+" to indicate concatenation, and
    perhaps use CStr(nameOrganizationUnit) to make it clear the value is a
    string.
     
    Richard Mueller [MVP], Jun 21, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.