In a recent engagement I found myself fighting with the following error on vRO 6.0.1
Can’t find method ch.dunes.ad.object.Container.search(string,string). (Dynamic Script Module name : getAD_UserForUsername#3)
var users = ActiveDirectory.search("User", USER_NAME);
This happened to come from an existing vRO Action known to be working. The scenario I was troubleshooting was the following:
- vCO 5.5.1 + AD plug-in 1.0.3. Code known to be working
- vCO upgraded to 5.5.2 + AD plug-in 1.0.6 Code not tested, unknown to be working
- vCO upgraded to vRO 6.0.1 + AD plug-in 1.0.6 Code not tested, unknown to be working
- vRO 6.0.1 + AD plug-in 2.0.1 Code not working
Not knowing if the problem was caused by something wrong within the plug-in after the upgrade from vCO to vRO I decided to upgrade the AD plug-in to version 2.0 Build 254302 (step 4). This did not change a thing. The AD plug-in was configured to use a shared session plus a service account with read only access to Active Directory. So far so good. Next step to check was the API library explorer.
API Library documentation from AD plug-in version 1.0.6
API Library documentation from AD plug-in version 2.0.1
As you can see the search method on plug-in 1.0.6 requires two parameters whereas 2.0.1 requires three, the third one being the AD_Host. It also says “if not provided default Active Directory server will be used“. This is the key to the problem! Although the API documentation say the parameter adServer is optional, it is not!
So you need to pass this an object (if you pass a string it will not work) so the new revised call to the method will look like this:
ActiveDirectory.search("User", USER_NAME, adHost);
As I couldn’t find anything on the VMware KB or Communities Forum I hope this article will be of help 😉
****** UPDATE 05-Jun-2015 *****
Thanks to Burke Azbill from the vCOTeam for letting me know that this issue has been fixed on release version 2.0.1-2597988.
The current most updated version is 2.0.2-2670588 and, although not official yet, is available for download at https://communities.vmware.com/docs/DOC-25138
I would also like to thank Timo Sugliani for letting me know that Burke Azbill posted a comment on my article 😉