VMware Cloud Community
NemesisSaints
Contributor
Contributor
Jump to solution

Requesting JavaScript code sample to move MS AD group

I am looking for some JavaScript code samples and/or templates to move a Microsoft Active directory group from one OU to another when plugged into VMware vRealize Orchestrator. The AD plugin is installed.

Group Name: TestSvrName_Admins

From: OU=SrvAdminsGroups,OU=AdminGroups,OU=Admin,DC=CompanyName,DC=COM

To: OU=Groups,OU=ToBeDeleted,DC=CompanyName,DC=COM

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Check API Explorer documentation for scripting method ActiveDirectory.rename(). The following call should work:

var from = "CN=TestSvrName_Admins,OU=SrvAdminsGroups,OU=AdminGroups,OU=Admin,DC=CompanyName,DC=COM";

var to = "CN=TestSvrName_Admins";

var newParent = "OU=Groups,OU=ToBeDeleted,DC=CompanyName,DC=COM";

ActiveDirectory.rename(from, to, newParent);

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.

View solution in original post

4 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Check API Explorer documentation for scripting method ActiveDirectory.rename(). The following call should work:

var from = "CN=TestSvrName_Admins,OU=SrvAdminsGroups,OU=AdminGroups,OU=Admin,DC=CompanyName,DC=COM";

var to = "CN=TestSvrName_Admins";

var newParent = "OU=Groups,OU=ToBeDeleted,DC=CompanyName,DC=COM";

ActiveDirectory.rename(from, to, newParent);

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.

NemesisSaints
Contributor
Contributor
Jump to solution

Rename entry failed!0000208D: NameErr: DSID-03100238, problem 2001 (NO_OBJECT), data 0, best match of:

'OU=SrvAdminsGroups,OU=AdminGroups,OU=Admin,DC=CompanyName,DC=Com' \u0000 (Workflow:Copy of Move VM AD Group to ToBeDeleted /

Scriptable task (item1)#3)

0 Kudos
NemesisSaints
Contributor
Contributor
Jump to solution

Never mind. The next time I ran it, that error went away and it worked perfectly. Thanks for your help.

0 Kudos
NemesisSaints
Contributor
Contributor
Jump to solution

One more question.

How would I write the same thing with spaces in the Active Directory Distinguished Name?

For example, with Srv Admins and Groups separated:

var from = "CN=TestSvrName_Admins,OU=Srv Admins Groups,OU=AdminGroups,OU=Admin,DC=COMPANY,DC=COM";

var to = "CN=TestSvrName_Admins";

var newParent = "CN=TestSvrName_Admins,OU=Groups,OU=ToBeDeleted,DC=COMPANY,DC=COM";

ActiveDirectory.rename(from, to, newParent);

I have another workflow very much like this one that fails with: NameErr: DSID-03100238, problem 2001 (NO_OBJECT), data 0.

I am almost certain the spaces are the issue. I have read to use backslashes and/or to put single quotes inside double quotes. Do you know how VRO prefers it to be written?

0 Kudos