Hey all,
I am trying to do something quite simple, or what should be simple. I am trying to simply add a computer account to a group with vRA with vRO. Sounds simple with this workflow, Add computers to group members. However, I need to pass in strings.
I have been able to get the strings converted (or I thought) to the proper complex data types/
AD:UserGroup
Array/AD:ComputerAD.
The computer account part works fine with this code (stolen from here)
var computers = ActiveDirectory.getComputerADRecursively(computerName);
System.log("Computer count: "+computers.length);
for each (pc in computers){
System.log("Checking computer: "+pc.name);
if (computerName.toLowerCase() == pc.name.toLowerCase()){
System.log("Found Computer: "+pc.name);
return pc;
}
}
// Nothing found so throw exception:
throw "No matching Computer found: " + computerName;
I tried to do the same thing for the group with this code.
var userGroup = ActiveDirectory.searchExactMatch("UserGroup",userGroup_str,1);
System.log("Checking user: "+userGroup);
It fails. When I click on the variable after the fact, I can see the computers variable looks proper as it has the DN, etc, etc. When I view the other variable, it doesn't look right. When using this code to add the elements (the account to the group)
userGroup.addElements(adServer);
I get this error.
015-05-21 15:08:26.669] [I] TypeError: Cannot find function addElements in object DynamicWrapper (Instance) : [AD_UserGroup]-[class ch.dunes.ad.object.UserGroup] -- VALUE : UserGroup rest of the group DN is here....
I am not handling the array properly, and I am obviously not an expert. Any help would be greatly appreciated.