I want to get the AD Users group membership using the plugin.
There are two methods I have tried and both fail:
1.
ADUser.getAttribute("memberOf");
- this returns only the first group the AD user is the member of; In the AD the groups (group DNs) are separated by semicolons - why is only the first value returned?
2.
var ADGroups = new Array();
ADGroups = ADUser.memberOf;
- this should return an array of AD:UserGroups, the number of returned groups is correct (checked with .length), but each value is null:
for each (ADGroup in ADGroups){
System.log(ADGroup.getAttribute("distinguishedName"));
}
output: TypeError: Cannot call method "getAttribute" of null
What would be the correct way to return an array of groups the Ad user is a member of?
Edit:
I've tried to use the newest 3.0.0 plugin from here too: Technical preview version of VMware vCenter Orchestrator Plug-In for Microsoft Active Directory
Version 3.0.1 of the plugin containing fix for memberOf properties is available here Technical preview version of VMware vCenter Orchestrator Plug-In for Microsoft Active Directory
Thanks for trying out latest version of the plugin and providing feedback.
I just try out your code and received similar result when using User.memeberOf property.It looks like regression in version 3.0.0 of the plugin. I will open an internal issue and I will check it.
Meanwhile if you need the list of DN's stored in memberOf property you can try out following code
var ADGroups = new Array();
groupDns = user.getArrayAttribute('memberOf');
for each (dn in groupDns){
System.log("Group dn " + dn);
}
Version 3.0.1 of the plugin containing fix for memberOf properties is available here Technical preview version of VMware vCenter Orchestrator Plug-In for Microsoft Active Directory
Thank you for to fast resolution, the new version works fine!