Whenever I work with Active Directory and I want to use pretty complex LDAP Filter to search for objects I’m after I’m tempted to use line break here and there to make whole thing easier on eyes of future reviewer (even if the only person to read the code is me “few weeks later”).
Today something very simple, basic and hardly clever. I’m blogging about it only because I couldn’t find any resource that would help me with doing that directly from PowerShell. I tried to do that in smarter way, but so far failed. If you know a better way than this one – please don’t hesitate and share your knowledge with me (and others)
To the point: last few days I’m working on a larger script that should help AD team to fix orphaned admin accounts. While testing I needed a way to trigger SDProp at will, as described in this article.
Active Directory is one of those things I just love to work with. That’s why I was looking forward to the entries in this particular event. I found out few things I was not aware of while reading some of the entries, but also seen some mistakes that I would like to highlight. As always: I will start with Beginner category “positives”, and move on until I get to “negatives” in Advanced category.
I’m bit behind the schedule with this event. That happens: life sometimes interferes plans.
Also, today I wanted to focus on two parts of assignment: 20 random users, translating Active Directory date into nice (DateTime) format.
As much as I like tools designed for work AD – both from Microsoft and Quest – I’m sometimes amazed how quicker pure ADSI/ ADSISearcher calls can be. Today I said to myself: enough. I know LDAP Filters/ ActiveDirectory attributes good enough to write simple function for myself that would give me all advantages cmdlets give of former, and lightning speed of latter.
Also: I know, I can use LDAPFilters in either tools, but I do not like that I have to pass full filter, I wanted something interactive-work friendly. Normally you have to move back and forth (unless you always start with “(&())”) and always remember to quote everything (or escape brackets).