Craig_G2
Hot Shot
Hot Shot

ActiveDirectory.search - Search for OU by DN

Jump to solution

Hi Guys,


Having a head scratching moment using the AD plugin and the search method of the ActiveDirectory object in orchestrator.


In my environment it is highly possible that there will be Organizational Units with the same name located in different parts of the domain tree.. So to search and get an accurate object you would need to search by something unique, like the DN. However it only appears that you can search for an OU by name, which returns an array of objects.


One way to mitigate this would be to have ouName and ouDistinguishedName as inputs to the workflow.. but this seems silly.


Is there a way to search AD by DN to return a specific object or will I have to impliment logic to match the output of var adSearch = ActiveDirectory.search("OrganizationalUnit",ouName); to an input string that contains the DN?


Hope someone can shed some light


Cheers

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee

Here you go: Add Computer to OU by String / getOUByName

Seems a frequent request lately so I've shared it to the community Smiley Happy

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
3 Replies
zdog59
Enthusiast
Enthusiast

Hi,

Like you I was hoping the ability existed to query by DN, but does not appear to be the case.  To avoid any potential complications with a similar issue, I did a query on the name and returned a set/array of objects.   From there, I looped through each to compare DN from the AD returned object to verify I had the correct one and then broke out of the loop and moved on. Pretty simple but not the most efficient.

If you need some sample code I can did something up.

Cheers

Burke-
VMware Employee
VMware Employee

Here you go: Add Computer to OU by String / getOUByName

Seems a frequent request lately so I've shared it to the community Smiley Happy

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Craig_G2
Hot Shot
Hot Shot

Thanks to you both for your replies!

Burke- I'll be testing out your action tomorrow AM! Thanks.

0 Kudos