Automation

 View Only
  • 1.  ad host to dswitch after joining vcenter

    Posted Jul 29, 2010 06:34 AM

    I am busy with my postinstall script for esx4i.

    I use the function add-dvswhost from lucd.info

    After i add the esxi host to vcenter i want it to join the dswitch, but for some reason i get the following error when i just added the server to vcenter:

    Get-View : Cannot bind parameter 'Id'. Cannot convert the
    "VimApi_41.ManagedObj
    ectReference" value of type "VimApi_41.ManagedObjectReference" to type
    "VMware.
    Vim.ManagedObjectReference".

    If i execute the function again, when the server is in vcenter i don't get an error.One thing i did notice is that when i add the esxi host to vcenter is that when the HA agents get installed it does a network refresh.

    Who has the solution for me? 
    

    </div>



  • 2.  RE: ad host to dswitch after joining vcenter

    Posted Jul 29, 2010 06:43 AM

    Rob, can you give a bit more info ?

    I assume you're working with the 4.1 version (ESXi and vCenter) ?

    Are you also using PowerCLI 4.1 or PowerCLI 4u1 ?

    And perhaps the complete error message with the line number ?

    It's probably the following line that causes the error

    $task = Get-View $taskMoRef
    

    Could you try replacing it by this

    $task = Get-View ([http://VMware.Vim.VIConvert|http://VMware.Vim.VIConvert]::ToVim($taskMoRef))
    

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 3.  RE: ad host to dswitch after joining vcenter

    Posted Jul 29, 2010 06:52 AM

    vCenter and ESXI are both version 4.1. Powercli is alo version 4.1

    I also get an error before (i forgot to add that as well)

    Exception calling "ReconfigureDvs_Task: with 1 argument(s): "Not initialized: vim.hostsystem.host"

    When i call the function after the server is already in vcenter, then there is no prob.



  • 4.  RE: ad host to dswitch after joining vcenter

    Posted Jul 29, 2010 08:11 AM

    I added a do while loop, so i am certain the MoRef from the host is there.