Jeremie_R
Contributor
Contributor

Workflow to set description field of AD and local computer

Jump to solution

HI,

I would like to create a little workflow to set AD and local description of computer.

if someone have an idea....

thank you in advance

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee

Please review the scriptable task, inputs, and bindings of the attached workflow that I created when originally answering your question...

You may import the attached workflow and test/modify it as desired.

Workflow Inputs:

computerAD (AD:ComputerAD) -- this is the computer object in the AD plug-in that will have its description field modified

newDescription (string) -- the new value of the description for the selected computer object

Scriptable task:

The scriptable task input has both of the workflow Inputs bound to it allowing access to these values within the script.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
9 Replies
tschoergez
Leadership
Leadership

Hi,

I don't think that is possible using the AD Plugin for vCO (because this doesn't expose the functionality).

However, nothing is impossible in vCO, you just have to be more creative...

My next try would be: Use the Powershell plugin to call out to a powershell script that does the job. Quick google found some examples, I'm sure there are plenty more: http://dmitrysotnikov.wordpress.com/2007/07/25/set-any-ad-attribute-with-powershell/

http://stackoverflow.com/questions/6603519/modify-attributes-in-ad-via-powershell-no-quest

Cheers,

Joerg

0 Kudos
Burke-
VMware Employee
VMware Employee

Assuming you have the Active Directory plug-in installed and have the appropriate permissions, the following code will allow you to set the new description of the computer object.

Inputs: computerAD (AD:ComputerAD), newDescription (string)

System.log("Old Description: "+computerAD.getAttribute("description"));
System.log("Setting new description...");
computerAD.setAttribute("description",newDescription);

The above code, when placed into a workflow with the inputs bound, will prompt you for a computerAD object and Description. Upon submitting, the code will display the current description, then proceed to set the new description as defined.

This code addresses the computer object in AD, I'm unsure what you mean by "Local"

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
Jeremie_R
Contributor
Contributor

If I understood, I need to create an action with your code proposed ?

0 Kudos
tschoergez
Leadership
Leadership

No need to create an action (you could do so if you plan to reuse that in multiple workflows, though).

You can just use a "Scriptable Task" element in the workflow, and add Burke's example there.

0 Kudos
Jeremie_R
Contributor
Contributor

I tried to use the exemple code to create an action but I'm beginner and it doesn't work.

If you can help me to create this

At the end, this action must set the description of computer AD and the local description

thanks in advance

0 Kudos
Burke-
VMware Employee
VMware Employee

Please review the scriptable task, inputs, and bindings of the attached workflow that I created when originally answering your question...

You may import the attached workflow and test/modify it as desired.

Workflow Inputs:

computerAD (AD:ComputerAD) -- this is the computer object in the AD plug-in that will have its description field modified

newDescription (string) -- the new value of the description for the selected computer object

Scriptable task:

The scriptable task input has both of the workflow Inputs bound to it allowing access to these values within the script.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Jeremie_R
Contributor
Contributor

Cool it is working fine !!!

But now I have a little pb because if I want to integrate to my original workflow (see attachement) I need to set automaticaly the ComputerAD.

WF-Deploy-Win.PNG

I think to place the WF "set Computer..." just after "Create a computer..." but how to set the ComputerAD ?WF-Deploy-Win2.PNG

0 Kudos
Burke-
VMware Employee
VMware Employee

You need to get the computer name and pass it to an action that will retrieve the computerAD object for you. You can find this action (getComputerADbyName) in the package attached to my article here: Remove computer from AD using vCO during vCAC Decommission Smiley Happy

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Jeremie_R
Contributor
Contributor

Hello,

I found a solution by myself :smileygrin:

I created a little action with this script :

var ArrayComputer = new Array();

ArrayComputer.push(ComputerName);

return ArrayComputer;

ComputerName are a parameters Type :AD:ComputerAD

Thanks for your help

0 Kudos