Get the vCAC:VCACHost of the vCAC:VirtualMachine

I don't know if I'm just being dense and missing something obvious, but it doesn't seem like the vCAC:VirtualMachine object has no way to enter the vCAC:VCACHost delegate.  I created an action that I think should work for most objects.  In a similar way to vCD, I had assumed that most of the objects would have a .parent attribute or a function to get the host.  At the moment I can't imagine we ever have more than one vCACHost in a vCO to be honest, but you know how it goes.  I wrote this action to return to the vCAC:VCACHost, but if there is a way more easy/better please let me know.

If (vCACVm! = null) {}

var vmParentId = vCACVm.getEntity () .hostId;

var host = Server.findAllForType ("vCAC:VCACHost");

System.log ("number of vCACHosts found:" + hosts.length);

{if (hosts)}

for each {(host var in hosts)

System.log ("Comparing hostId:" + host.id + "-VM managed by id:" + vmParentId);

If (host.id == vmParentId) {}

System.log ("looks at" + host.displayName + "is a game!");

Back home;

}

}

}

}

Hi Paul,.

Your action works. It could be reduced to:

host = Server.findForType("vCAC:VCACHost", vCACVm.getEntity().hostId);

Christophe.

Tags: VMware

Similar Questions

  • How to get the VC:VirtualMachine of a plan Director vcac

    I tried to follow this guide below to create a workflow to be run from a schema Manager vcac... Basically, I took the Vcac/infrastructure administrator/Workflow model

    who has this piece of code

    If (vCenterVm! = null) {}

    System.log ("Got vCloud VM" + vCenterVm.name);

    }

    Well, it does never print the name of the virtual machine. I need to run operations on the virtual machine after the virtual machine is deployed. How I am able to do it... and why would the model if she

    not availabl.e

    How to extend the vCAC vCO part 2 & amp; #8211; Hello World Script in Guest | VMtoCloud.com

    That's why I asked what state he was executed... If during BuildingMachine, then there is no machine virtual no object... it has not been created/cloned/whatever. Important diagnostic data!

  • Get all the vCAC:VirtualMachine

    Hello

    I will try to find all the VMS (vCAC:VirtualMachine) connected to a vCAC:vCAChost, put them in a table/loop, then use System.getModule("com.vmware.library.vcac").getPropertiesFromVirtualMachine (vCAChost, ARRAY), to get all the properties for all machines,

    I looked around and tried several actions but found no one that gets me what I want.

    There is a getAllVMsMatchingRegexp that works perfectly for com.vmware.library.vc.vm but not for com.vmware.library.vcac!


    I'm I missed something or there is a work around, Can someone help me understand this?

    Thank you

    Hello

    Hope the script below helps you.

    This will retrieve the entity VM VCAC by match the name of the computer, but you can customize and iterate with action "getPropertiesFromVirtualMachine" to get the properties.

    var vCACVirtualMachines = Server.findAllForType ("vCAC:VirtualMachine"); The machine used here vCAC ID is not the same as adopted by vCAC

    vCAC VM

    var vCACVM = null;

    for each {(var vCACVirtualMachine in vCACVirtualMachines)

    System.log("Name:"+vCACVirtualMachine.VirtualMachineName);

    If (vCACVirtualMachine.VirtualMachineName == virtualMachineName) {}

    vCACVM = vCACVirtualMachine;

    break;

    }

    }

    Kind regards

    Deepak

  • Getting the data center of VirtualMachine with Get-View information

    Hello

    Y at - it a faster way to get the name of data using Get-View and the viewtype VirtualMachine Center.

    I found the following:

    Get-View -ViewType VirtualMachine -filter @{ "name" = "mtl1fsit02" } | Select-Object -Property Name,

    @{ Label = "GuestOSName"; Expression = { $_.summary.guest.guestfullname } },

    @{ Label = "Datacenter"; Expression = { (Get-view (Get-View (Get-view $_.parent).parent).Parent).name } }

    Thank you guys

    I think that the property calculated for the data center does not work in all situations.

    It assumes that your virtual machines are 3 levels down from the data center, which is not always the case.

    I personally use a loop, passing up through the parents, until he finds an object data center.

    something like that

    @{N = 'Center'; E = {}

    $parentObj = get-view $_. Parent

    While ($parentObj - isnot [VMware.Vim.Datacenter]({))

    $parentObj = get-view $parentObj.Parent

    }

    $parentObj.Name

    }

  • VirtualMachine.PowerOnVM_Task how to get the reference to the returned managed object - task

    Hello

    I try to use the VirtualMachine.PowerOnVM_Task that returns a reference to the managed object - task as ManagedObject reference. (The VirtualMachine is the result of the GET's view)

    I use it in VB:

    Var refTask As Vim.ManagedObjectReference = Vim_VirtualMachine.PowerOnVM_Task (Vim_VirtualMachine.Runtime.Host)

    I can get the reftask like ManagementObjectReference, but here I don't know how to convert the managed - object task. I like to use all the properties and methods of this object.

    Looking at my result of the refTask I can't find many properties...

    Is it possible to retrieve an object just to get the reference to the taskobject somhow.

    Concerning

    Manfred

    Hello

    You can get Moref managed object is either using the cmdlet Get-View or in VB, using the VimClient.GetView method, that is to say:

    Get-View -Id refTask
    

    or

     Dim task As Vim.Task = Vim_VirtualMachine.Client.GetView(refTask)
    

    Note that each MO is the customer's property which is of type VimClient.

    Kind regards

    Yasen

  • vCAC 6 WFStubBuildingMachine not find vCAC:VirtualMachine?

    When WFStubBuildingMAchine workflows or available to the vCAC kickoff, in the 'variables' tab on the right pane, it indicates that the type 'vCAC:VirtualMachine' is "not found." It lists the vCAC:Entity and the vcac:vcachost. I need this to be found so I can pull properties directly from the virtual machine such as OS type... This is shown/found during these workflows?

    I thought about it. It is not "hostname". That's what you would put in the field of the custom property in vcac, but this isn't what you put the JS code... go figure?

    The code to get the name of the machine during destroy/dcommissioning is:

    vmName var = vcacEntity.getProperty ("VirtualMachineName");

    See you soon

  • VC:virtualmachine and vCAC:VirtualMachine not transmitted from vRA at vRO

    Hello

    I have a Setup with the more recent vRA and more recent vRO external device. The plans use the CloneWorkflow to clone templates in vRA. There is also a workflow assigned (not not using Event Broker yet, still ExternalWFStubs) that is executed when a machine is supplied. So far, this perferctly worked. Now the underlying vCenter was Version 6 upgrade. Cloning of the machines still works perfectly and also the vRO workflow runs, but there is a problem: the attributes VC:VirtualMachine and vCAC:VirtualMachine are not transmitted to vRA to the vRO triggered workflow if it fails (they are configured as the input of the main workflow parameters). Anyone have any idea what could be the reason and how can I fix it? I'm a little at a loss because I do not see any errors in the logs next to these parameters are not passed on more and I can't really identify why the update of the vCenter influence the parameters vRA passes on vRO. VRA Plugin is installed on the external vRO and is the most recent version.

    Best regards

    JensVM

    For more information, vRA passes a string containing the name of the VM at vRO vCAC. vRO then runs runner/worker plugin vRA workflows that get the vCAC:VirtualMachine and the objects of their respective plugins VC:VirtualMachine. You could look at workflows of rider and see if you get the objects there or if they get lost somewhere else in the process.

  • Looking for a vCAC:VirtualMachine of a vCACCAFE:CatalogResource

    I hope that I am watching this right in the face and have not only put together how to proceed.  I just want to get the vCAC:VirtualMachine or objects associated with a vCACCAFE:CatalogResource.  I don't see an easy way to do it.  I see some properties of the vCACCAFE:CatalogResource which I might well be the leader back to the vCAC:VirtualMachine uuid, but nothing seems to jive.  These things are obviously related.  Help!

    I hope this isn't too late... How to get the actual VM IaaS to a provisioned catalog vCAC resources VM?

  • Why I can't get the IP address set correctly?

    Hi, I have a problem while using the vCAC 6.0.1 network profile.  I followed the guide and deployed the iaas application can create the virtual machine by using linked Clone and Clone.  But when I use the network profile to get the IP address of the range that I have already mentioned, the VM simply isn't the right IP address, while I can see the IP address of the vcac portal...

    I put my 192.168.1.100.110 IP range, include this profile in reserve and created a property profile that defines the custom property "VirtualMachine.Network0.ProfileName is my_network_profile_name".  Can I use it to create my plan.  After I have ask a virtual machine does not error, and I can see the right IP address since the details of the article, while it is not configured on the virtual machine.

    Does anyone have this problem before?

    Thank you.

    What is the OS of the VM?

    I found that using Linux I had to configure a vsphere comments customization that has forced the DHCP on the VM at deployment time so that vCAC is able to inject then the IP address.

    Danny

  • How to get the details in an expression

    Hi all

    Just start with vsphere powerCLI again and I wanted to understand the basics of hash tables. I've been running this command as below:

    Get - VM VM1. Get-View | Select-Object Name, @{N = "ToolsVersion"; {E = {"$_.config.tools.toolsVersion"}}

    and I wanted to understand:

    1. am I correct assuming that by this, we create a new Toolsversion property object?

    2. How can I retrieve all the values that are available to me? Specifically, I want to ask from where comes this expression comes, E = $_.config.tools.toolsVersion and how to find all the expressions that are available to create new properties.

    THX,

    AJ

    1. Yes, the Select-Object cmdlet will produce a new object on this object, you have a new property called ToolsVersion

    You can see by channelling the results of the Get-Member cmdlet.

    2. with the cmdlet Get-View, you get the vSphere .net object object.

    These objects of vSphere are described in the VMware vSphere QAnywhere

    In this particular case, you can check the VirtualMachine object.

  • PowerCLI - get the number of cores per processor and number of Sockets

    Greetings,

    We are responsible to give a list of all our virtual machines with their host name, the number of CPUs, the BONES and the number of cores per processor for verification.

    I immediately said that this would not be a problem with PowerCLI. However I seem to have more trouble with it than expected.

    Get the number of CPUS is not a problem, but the time wherever I want to divide the number of cores and the number of sockets, it seems to hit a dead end.

    I found the following entries of the community concerned:

    Re: vSphere 5. Casings of vCPU and cores per CPU (PowerCLI) bug

    Machine virtual access avancΘs | VMware vSphere Blog - VMware Blogs

    Parameters to retrieve and set Advanced Configuration (VMX) VM

    But neither seemed to give me the right input. The advanced configuration settings do not appear to contain the number of cores/sockets and Get-View and Get - VM normal controls do not seem to differentiate between carrots and the power outlets and just give the number of processors.

    Because we need these settings for a check I doubt I'm the first to need this information. Does anyone have an idea how to get this information?

    Please note that it is the number of cores and casings of a VM, not an ESXi host.

    Thanks in advance,

    Bram

    $result = @)
    $vms = get - view - ViewType VirtualMachine
    {foreach ($vm to $vms)
        $obj = new-object psobject
        $obj | Add-Member - MemberType NoteProperty-name name - value $vm. Name
        $obj | Add-Member - MemberType NoteProperty - name CPUSocket-$vm.config.hardware.NumCPU value
        $obj | Add-Member - MemberType NoteProperty - name Corepersocket-$vm.config.hardware.NumCoresPerSocket value
        $result += $obj
      
    }
    $result
  • Get the output parameter of workflow using soap in PHP

    Hi all, I have a question on how to print the output in php parameter using the soap Protocol. I create the workflow with 1 single task scriptable with variable name of virtual machines as output like that.

    var sdkConnections = VcPlugin.allSdkConnections;
    vms = new Array();
    for (var i in sdkConnections) {
      var host = sdkConnections[i];
      var found;
      if (host.isInventoryServiceAvailable()) {
      found = host.getAllVirtualMachines();
      }
      for (var j in found) {
      vms.push(found[j]);
      System.log(vms);
      }
    }
    

    And my php, source code

    <?php
    
    include ("parameters.inc");
    $vco = new SoapClient('https://' . $vco_server . ':8281/vmware-vmo-webcontrol/webservice?WSDL');
    $workflowid = "f73f2521-0e6b-48e8-81b9-388b13fc3fea";
    $param = array(workflowId=>$workflowid,username=>$vco_user,password=>$vco_pass);
    echo '<br>';
    
    $result3 = $vco->executeWorkflow($param);
    print_r($result3);
    echo '<br>';
    
    foreach ($result3 as $token)
    {
            $tokenID = $token->id;
    }
    
    $param2 = array(workflowTokenId=>$tokenID,username=>$vco_user,password=>$vco_pass);
    $wftokenstatus = $vco->getWorkflowTokenStatus($param2);
    print_r($wftokenstatus);
    echo '<br>';
    
    $wftokenresult = $vco->getWorkflowTokenResult($param2);
    print_r($wftokenresult);
    echo '<br>';
    ?>
    

    When I try the same, executed release in web

    stdClass Object ( [executeWorkflowReturn] => stdClass Object ( [id] => ff808081440b6eb90144316de4bc04fe [title] => Copy of Get virtual machines by name [workflowId] => f73f2521-0e6b-48e8-81b9-388b13fc3fea [currentItemName] => __item-undefined__ [currentItemState] => running [globalState] => running [businessState] => [startDate] => 20140215002449+0700 [endDate] => [xmlContent] =>         ) )
    stdClass Object ( [getWorkflowTokenStatusReturn] => )
    stdClass Object ( [getWorkflowTokenResultReturn] => stdClass Object ( [name] => vms [type] => VC:VirtualMachine [value] => ) )
    

    I see in customer orchestrator, my workflow work well and in the logs tab I see all my VM appear, but I'm trying to print all components of table in my php script using print_r(), the value of the object always null, only can get name and type as above... No idea how to get the value of the output parameter?... Thanks before

    Change this code to your:

    for (var j in found) {
      vms.push(found[j]);
      System.log(vms);
      }
    

    To do this:

    for (var j in found) {
      vms.push(found[j].name);
      System.log(vms);
      }
    

    In this code, j is a VC:VirtualMachine object, instead of pushing the entire object in your table, just push the virtual machine to .name property. Additionally, make sure that your output variable is of type: Array of Strings

  • Get the object of StoragePod storage profiles [vCloud Director]

    Hi all

    I'm automating DTS stuff for the creation of new vApps in vCloud Director and I want to integrate and use the workflow to Change Storage DRS by virtual machine configuration , but to do this I need to provide him with an object of type VC:StoragePod...  I have worked out how to get the default storage of each virtual computer profile, but may not know how to get to the StoragePod that it covers.

    Don't laugh, but I only managed to get this far before getting stuck:

    var vms = vApp.getChildrenVms();
    for each (var vm in vms) {
     storageProfile = vm.storageProfile;
     ....
    }
    

    Can someone show me how to get a StoragePod of a profile of storage object ideally default virtual machines?

    Thank you!

    Mark

    Have you had the opportunity to see this thread: http://communities.vmware.com/message/2147437#2147437 - it seems debating what you are interested... The catch here is that you are trying to do from the side the cloud... I can't look at this right now, but I suspect that you MUST have access to the underlying infrastructure to do what you ask... in this case, you will need to extract the object from VC:VirtualMachine of your vCloud:VM object, then the thread above can deepen assistance.

  • Use get - view to get the host data center

    Hey guys,.

    I'm trying to shoot the host number of name and the version with get-view.

    I got to that, but I also want to get the data center that host belongs to.

    How can I get that advice please, don't have Googling has not helped a lot.

    Thank you

    RJ

    With the ExtensionData property we have access to the object VirtualMachine .

    Most of the managed objects vSphere has a property, called Parent, which points to the object that is connected to our object (the ' mother' in other words).

    The content of the Parent property is a MoRef (pointer). To get the real object, we use the cmdlet Get-view with this MoRef.

    We repeat this process in a while loop until the parent object is an object of data center .

    It's a bit like the structure of the tree in the vSphere Client.

    You start with the ESX (i) server and back up in the tree until you encounter a data center.

  • How to get the path of the vmdk to a VM stop file?

    Hi guys,.

    How to get the path of the vmdk to a VM stop file in ESX Server via the VIX API?

    I try to get it via the VixVM_ReadVariable() function. but it seems that this function requires that the virtual machine is power on.

    I don't want to go the virtual machine started, I just want to know if I can get the path of the vmdk file when a virtual machine is power off.

    Thanks in advance.

    Sorry, I don't have any samples.

    However, if you look at the layoutEx of the managed object VirtualMachine field, you will see that the VirtualMachineFileLayoutEx data object has a field "files" which should contain the paths of affected files.

    I hope that it should be able to help get started.

Maybe you are looking for

  • How to transfer an address book in Outlook

    I have an old computer with an address book that I created in Outlook express. I want to transfer to a Thunderbird addressbook. I tried the export to a file of card to a flash drive and tried to import Mozilla feature, but it seems that one at a time

  • Tecra 9000 - DC led flashing light 01001110

    I have a problem with my laptop, it's a Tecra 9000. When I press the button start powerTour LED from yellow to orange. Then the LED flashes 8 times. SLSSLLLS = 01001110. Peutcan you tell me what this error code means? Thank you for all your answers P

  • Pavilion X 360 Pentium 320: my internet is not working please help

    Hi I use my laptop almost everyday that I am a student and I am almost always on the internet at home and at school. When I go to school, I always had to turn my proxy settings to use internet then disable them again to use internet at home. But rece

  • scanner Photo Scanjet 4050

    Downloaded the software complete and even installed with poor results. In the installation, I get a box that is supposed to have a file name, but have no way to find the same. There is the number one (1), but this is not correct, the error message sa

  • my program memory

    How will I know how much memory taken for my program. These forums while loop takes how much memory etc...