This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

eDir query with Powershell gives weird values for some attributes

Hi

New to LDAP queries and eDirectory. We have multiple IDM environments were sometimes driver packages get out of sync during testing/development.

My boss asked me if it was possible to quickly query and compare all the packages in our environments in an automated way. So decided to write a Powershell script to grab and compare those values from eDir.

With the help of the previous discussions I was able to establish a successful secure LDAP connection to query some values.

However, when querying values from an attributes, I get values that doesn't make any sense.

for example :

$ModelRequest.Entries[0].DistinguishedName ==> output ==> cn=some_driver,cn=some_Driver_set,o=system (this is fine)

$ModelRequest.Entries[0].Attributes ==> see table below

Name                              Value
----                                   -----
dirxml-tracesizelimit        {49 48 48 48 48 48} (<=== what is this?)

While the expected value for dirxml-tracesizelimit  is just 100000

Anyone have an idea why I'm not getting the expected output?

  • Verified Answer

    +1  

    They are ascii numbers. 49 = '1' and 48 = '0' - sqljunkieshare.com/.../

    Why Powershell does this, I do not know, as the schema defines it as an integer.

  • Verified Answer

    +1 in reply to   

    Thanks, indeed.

    In case somebody else faces this issue: This is how you can get the string value of it:

    $ModelRequest.Entries[0].Attributes['dirxml-tracesizelimit'][0].ToString()

  • 0   in reply to 

    I will point out that Packages are going to be a tad tricky to compare directly via LDAP.  When you get there, you will start asking the right questions...  But you have a way to go before you hit those problems.

  • 0   in reply to   

    You can get the package information from the DirXML-pkgGUID attribute, I do belive it was Norbert who shared this - where I do not remember:

    def parse_dirxml_pkgguid(value):
        "parse a DirXML-pkgGUID value into a dict"
        DIRXML_PKG_FIELD = ["id", "package", "version", "name", "short_name"]
        pkg = dict(zip(DIRXML_PKG_FIELD, value.split(";")))
        # for some entries, the name and short_name parts are missing (deployed with older Designer versions?)
        if "name" not in pkg:
            log.debug("incomplete DirXML-pkgGUID: %s", value)
            pkg["name"] = pkg["package"]
        return pkg

    That should make it reasonable easy to write code which compares data among multiple trees.

  • 0 in reply to   

    thanks! any chance you can refer me to the original post?

  • 0   in reply to 

    Sorry, I do not remember where I got it - and I have had it for a very long time.

    Depending on what you want, you can choose one tree to be the "master", store the information in a dict/array, then loop through it, and see if the same information exist in the other trees.

    I normally store the end result in csv as it's easy to use excel (or Numbers.app) to sort it.

    In general terms you compare treeA against treeB, you can then choose to compare treeB against treeA, and so forth.