jonathanvh
Enthusiast
Enthusiast

Searching user in AD

Jump to solution

Hi,

I'm using Orchestrator to get a user from a container.

But I don't know in which subcontainer (or sub-subcontainer) the user is in.

I have this line that returns the user when you are in the correct container:

var ad_user = System.getModule("com.vmware.library.microsoft.activeDirectory").getUserFromContainer(container,username) ;

But I want the code to search through all subcontainers as well.

Can anybody help me?

Kind regards,

Jonathan

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Jalapeno420
Enthusiast
Enthusiast

Try the nifty search on the ActiveDirectory object.  You can also use it to search "ComputerAD", "UserGroup", "Group", and "OrganizationalUnit".

adObjectArray = ActiveDirectory.search("User",queryString);

View solution in original post

0 Kudos
3 Replies
Jalapeno420
Enthusiast
Enthusiast

Try the nifty search on the ActiveDirectory object.  You can also use it to search "ComputerAD", "UserGroup", "Group", and "OrganizationalUnit".

adObjectArray = ActiveDirectory.search("User",queryString);

0 Kudos
jonathanvh
Enthusiast
Enthusiast

That's it!

Sometimes things can be easy Smiley Happy

Thanks for the help!

0 Kudos
Burke-
VMware Employee
VMware Employee

And for even better results, use the newer .searchExactMatch method Smiley Wink The sample below assumes that there is an input named "userName" of type string that is to be searched for. This helps differentiate between: jdoe and jdoe2

var users = ActiveDirectory.searchExactMatch("User" , userName,1);

if (users != null) var user = users[0];

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