If I am understanding your question correctly, I believe you are looking to take some AD values and add them to a new provisioned machine, is that correct? If so, I am doing something similar but using ServiceNow and values as what I add to a provisioned VM. I have a workflow subscription that runs as the first workflow once a request is made that will do some processing with values presented in the request and then will update the vm be provisioned with the values that were just calculated. Actually take workflow populated 25 different values colllected during that stage so long story short, yes you can add AD values to the virtual machine. One of the first things I would do to setup that process is to create a Property Group in the Property Dictionary for your AD values you are looking to populate. For the name you can do something like this.... VirtualMachine.ActiveDirectory.DomainName.Attribute
Here is my template that I use to make updates
//var entity = virtualMachineEntity
System.log("Processing VM Information")
var virtualMachine = virtualMachineEntity.getInventoryObject();
if (virtualMachine == null)
{
throw "The virtual machine ID is invalid";
}
var MachineProperties = new Properties();
var virtualMachinePropertyEntities = virtualMachineEntity.getLink(vCACHost, "VirtualMachineProperties");
for each (var virtualMachinePropertyEntity in virtualMachinePropertyEntities)
{
var propertyName = virtualMachinePropertyEntity.getProperty("PropertyName");
var propertyValue = virtualMachinePropertyEntity.getProperty("PropertyValue");
MachineProperties.put(propertyName, propertyValue);
if (propertyName == "VirtualMachine.ActiveDirectory.DomainName.Attribute") {
System.log("Found the droid we have been looking for")
break;
}
}
//Got info and ready to update entity
var vmUpdate =
{
"PropertyName" : "VirtualMachine.ActiveDirectory.DomainName.Attribute",
"PropertyValue" : Attribute
};
//var virtualMachineProperties = new Properties();
var model = "ManagementModelEntities.svc";
var entitySet = "VirtualMachineProperties";
var links = new Properties();
links.put("VirtualMachineProperties",virtualMachineEntity); //The property needs to link back to the blueprint
var entityKey = virtualMachinePropertyEntity.entityKey;
var entityKeyId = entityKey.get("Id");
var entityUpdate = vCACEntityManager.updateModelEntityBySerializedKey(vCACHost.id , model , entitySet, entityKeyId , vmUser, links