VMware Cloud Community
BackOfficeTeam
Contributor
Contributor
Jump to solution

Orchestrator how to automatic add computer to the specific OU and change Computer Description

Hi

We are using VMware Orchestrator to clone from templates, sysprep VM and join VM to the Domain.

The problem is that we can’t find a function in Orchestrator to join VM to the specific OU and change Computer description.

Our workflow is building  sysprep on the fly so we can’t add a command in the sysprep to join to the specific OU

Plugin installed:

  • VIX
  • Active Directory

Workflow Example:workflow.png

Any ideas how to setup our requirements in the Workflow

Reply
0 Kudos
1 Solution

Accepted Solutions
robrtb12
Enthusiast
Enthusiast
Jump to solution

Hello,

Over the past couple of months I've learned Orchestrator and built an extensive highly custom workflow for automating windows and linux deployments from templates.  We also deploy into two seperate Datacenters that each have their own OU in AD.  The solution I use is "dsadd computer" (http://technet.microsoft.com/en-us/library/cc754539(WS.10).aspx) and then afterwards I execute 'netdom' on the windows OS which adds the server to the domain and reboots.

I use sysprep for configuring IP, etc but not for joining the server to the domain.  After sysprep has completed I execute the code below to add the computer object to the specific OU:

var cmdText = "cmd /c ";
var cmdLine = "dsadd computer \"" + att_AD_OUPath + "\" -desc \"" + arg_in_AD_ComputerDescription + "\" -u " + att_domainUser + " -p " + att_domainPass;

command = new Command(cmdText + cmdLine);
returnCode = command.execute(true);

if (returnCode == 0)
{
System.log("Computer '" + arg_in_serverName + " has been added to the domain");
}
else
{
//throw "Error adding computer '" + arg_in_serverName + "' to domain.";
System.error("Error adding computer '" + arg_in_serverName + "' to domain.");
}

Setup:

  • Standalone Orchestrator installed on Server 2008
  • Active Directory Domain Serives role installed on the Orchestrator server

Hope this helps!

Message was edited by: robrtb12

View solution in original post

Reply
0 Kudos
7 Replies
tschoergez
Leadership
Leadership
Jump to solution

Hi!

I cannot find an "move-to"-Method / Action in the Active Directory-plugin 😞

So you can try a workaround: Build a local Powershell-script which moves the Computer to the OU, and then call the Powershell script via orchestrator

(http://www.vcoportal.de/examples/vco-powershell/)

I have successfully done it this way a couple of month ago, unfortunetaly I don't have access to the code right now...

edit: maybe it works when you create a computer object for the new computer in AD via the plugin, before you start the VM for the first time..!?!

Regards,

Joerg

Reply
0 Kudos
BackOfficeTeam
Contributor
Contributor
Jump to solution

Maybe it will work but not a fan of doing that way 🙂

"maybe it works when you create a computer object for the new computer in AD via the plugin, before you start the VM for the first time..!?!"

It is not a option to move Vm from OU to OU need to joint to the specific OU Smiley Sad

"Build a local Powershell-script which moves the Computer to the OU",

Any other ideas

Reply
0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

hm, when you create a sysprep-answer-file dynamically, you can add ou-specific information there.

(following an discussion here:

http://communities.vmware.com/message/1744734#1744734

)

Some more infos I found about:

http://blog.remyservices.net/2008/01/24/sysprep-in-depth-part-5-addition-1-customizing-sysprepinf/

Unfortunately I don't see a way to specify the OU when using the customizationspecification from vSphere API, since there is no part for the OU in the model (despite it's complexity :smileyangry:)

regards,

joerg

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

This is one of the use cases my team has provided to Engineering for making the AD plug-in. I cannot provide any more info ATM since I am boarding a flight.

It may be worth digging in the plug-in for workflows / action / methods for adding an object to an OU.

If you do not find my team will look at this later.

Christophe.

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 vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
ivand
VMware Employee
VMware Employee
Jump to solution

Probably you can do following:

1. At the end of your workflow  include the workflow "Create a computer in an organizational unit " by providing cloned VM computer name and its domain

2. Add then add a scripting task, where you can add all needed attributes for this computer record in order to be well described in AD for your needs.

Adding attributes to AD computer object is like this:

var yourComputer = ... (this can be input parameter of the scripting task)

//adding description

yourComputer.addAttribute("description", "Some description");

I hope this will help. I am not sure how you can gain all needed attributes values.

Regards

Ivan

robrtb12
Enthusiast
Enthusiast
Jump to solution

Hello,

Over the past couple of months I've learned Orchestrator and built an extensive highly custom workflow for automating windows and linux deployments from templates.  We also deploy into two seperate Datacenters that each have their own OU in AD.  The solution I use is "dsadd computer" (http://technet.microsoft.com/en-us/library/cc754539(WS.10).aspx) and then afterwards I execute 'netdom' on the windows OS which adds the server to the domain and reboots.

I use sysprep for configuring IP, etc but not for joining the server to the domain.  After sysprep has completed I execute the code below to add the computer object to the specific OU:

var cmdText = "cmd /c ";
var cmdLine = "dsadd computer \"" + att_AD_OUPath + "\" -desc \"" + arg_in_AD_ComputerDescription + "\" -u " + att_domainUser + " -p " + att_domainPass;

command = new Command(cmdText + cmdLine);
returnCode = command.execute(true);

if (returnCode == 0)
{
System.log("Computer '" + arg_in_serverName + " has been added to the domain");
}
else
{
//throw "Error adding computer '" + arg_in_serverName + "' to domain.";
System.error("Error adding computer '" + arg_in_serverName + "' to domain.");
}

Setup:

  • Standalone Orchestrator installed on Server 2008
  • Active Directory Domain Serives role installed on the Orchestrator server

Hope this helps!

Message was edited by: robrtb12

Reply
0 Kudos
BackOfficeTeam
Contributor
Contributor
Jump to solution

Thanks Guys , Great response from community

Our Team decided that we will try robrtb Solution

Cheers

Reply
0 Kudos