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>
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
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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.
I added a do while loop, so i am certain the MoRef from the host is there.