VMware Cloud Community
pezh0re
Enthusiast
Enthusiast
Jump to solution

Trouble with Active Directory plugin

I'm trying to create some decom automation workflows leveraging the Microsoft/AD plugin (version 1.0.5) on my vCO 5.5.2 box. I'm running into a weird error and I'm hoping someone can help.

Right now, I'm only trying to leverage the ActiveDirectory.searchExactmatch() function to return an AD:ComputerAD object. The script is as follows:

var computers = ActiveDirectory.searchExactmatch("ComputerAD", Name, 1);

if (computers != null){

   var actionResult = computers[0];

}

My workflow takes as input Name of type string, ActiveDirectory of type AD:ActiveDirectory, and has an attribute actionResult of type AD:ComputerAD. I'm constantly getting this error - TypeError: Cannot find function searchExactmatch in object notfound. (Workflow:quick / Scriptable task (item1)#54823) - seemingly indicating that the AD:ActiveDirectory object is not found.


Maybe there's a permissions thing to this, but I have run the workflow as a domain admin and I still get that error. When I run the workflow, I am able to successfully browse my AD resource:

selectAD.png

Any ideas?

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Are you really sure that you have an input parameter named ActiveDirectory? ActiveDirectory is a scripting object singleton, so it is not really suitable for input parameter. Singletons are visible everywhere in the scripting code, and you can use <singletonname>.<methodname>(...) to invoke its methods.

BTW, by convention parameter names should not start with capital letter; eg. Name should be name. Please stick to this convention in order to avoid name clashes.

Then, it seems you've misspelled the method name you call. Instead of searchExactmatch it should be searchExactMatch (with capital 'M').

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Are you really sure that you have an input parameter named ActiveDirectory? ActiveDirectory is a scripting object singleton, so it is not really suitable for input parameter. Singletons are visible everywhere in the scripting code, and you can use <singletonname>.<methodname>(...) to invoke its methods.

BTW, by convention parameter names should not start with capital letter; eg. Name should be name. Please stick to this convention in order to avoid name clashes.

Then, it seems you've misspelled the method name you call. Instead of searchExactmatch it should be searchExactMatch (with capital 'M').

0 Kudos
pezh0re
Enthusiast
Enthusiast
Jump to solution

Thanks Ilian! It was a combination of all the things you mentioned. I was trying to pull from a few limited sources online and looks like I added some mistakes in there myself. It's working as expected now!

0 Kudos