Active Directory Reporting

(imported topic written by SystemAdmin)

Hello,

I’m trying to write relevance to list out computers and an OU based on if another OU exists.

i.e.

CN=USAL0AUBURL001,OU=USAL0AUBUR,OU=USAL0,OU=ITS,OU=WKS Accounts,DC=ageast,DC=one,DC=xxx,DC=xxx

If “OU=WKS Accounts” exists then list out the OU right before it, in this case OU=ITS. I’ve looked at some of the existing posts on active directory but I haven’t been able to get this correct yet.

I’d like to write this into an analysis but a custom report can work as well.

Any help or links would be much appreciated.

thanks,

Baraq

Console version 8.1.551.0 with DSS-SAM Version 1.3.1.597

(imported comment written by MrFixit)

q: (if (exists distinguished name whose (it contains “OU=WKS Accounts”) of it) then (following text of lasts “,OU=” of preceding text of first “,OU=WKS Accounts” of distinguished name of it) else nothing) of local computer of active directory

Use caution with AD queries, they are expensive and can post a significant load on your DCs.

(imported comment written by SystemAdmin)

Ok, so I was going in the complete wrong direction with this:) Thanks!!

I’m guessing that running this against 50k machines wouldn’t be a good idea then?

-Baraq

Console version 8.1.551.0 with DSS-SAM Version 1.3.1.597