Hi,
I'm trying to bind the PortGroup to the Software iSCSI Adadpter, with the following code.
$esxcli = get-esxcli -v2 -vmhost (get-cluster "iSCSI_Cluster" | get-vmhost)
$esxcli.iscsi.networkportal.add('vmhba65',$true,'vmk3')
$esxcli.iscsi.networkportal.add('vmhba65',$true,'vmk4')
Which when run gives the following error.
PS C:\Users\Administrator> $esxcli = get-esxcli -v2 -vmhost (get-cluster "iSCSI_Cluster" | get-vmhost)
PS C:\Users\Administrator> $esxcli.iscsi.networkportal.add('vmhba65',$true,'vmk3')
Cannot find an overload for "add" and the argument count: "3".
At line:1 char:1
+ $esxcli.iscsi.networkportal.add('vmhba65',$true,'vmk3')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
PS C:\Users\Administrator> $esxcli.iscsi.networkportal.add('vmhba65',$true,'vmk4')
Cannot find an overload for "add" and the argument count: "3".
At line:1 char:1
+ $esxcli.iscsi.networkportal.add('vmhba65',$true,'vmk4')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
Then I came across the following method from the book Learning PowerCLI : Second Edition.
$VMHost = Get-Cluster "iSCSI_Cluster" | Get-VMHost
$VMHostHba = $VMHost | Get-VMHostHba -Type iSCSI
$VMHostHba | New-IScsiHbaTarget -Type Send -Address 192.168.4.10
$VMHost | Get-VMHostStorage -RescanAllHba
$NetworkAdapter = Get-VMHostNetworkAdapter -VirtualSwitch iSCSISwitch -PortGroup "iSCSI1"
$IscsiManager = Get-View -Id $vmhost.ExtensionData.Configmanager.IscsiManager
$IscsiManager.BindVnic($VMHostHba.Device, $NetworkAdapter.Name)
Which when run gives the following error:
PS C:\Users\Administrator> $VMHost = Get-Cluster "iSCSI_Cluster" | Get-VMHost
PS C:\Users\Administrator> $VMHostHba = $VMHost | Get-VMHostHba -Type iSCSI
PS C:\Users\Administrator> $VMHostHba | New-IScsiHbaTarget -Type Send -Address 192.168.4.10
Address Port Type
------- ---- ----
192.168.4.10 3260 Send
192.168.4.10 3260 Send
PS C:\Users\Administrator> $VMHost | Get-VMHostStorage -RescanAllHba
SoftwareIScsiEnabled
--------------------
True
True
PS C:\Users\Administrator> $NetworkAdapter = Get-VMHostNetworkAdapter -VirtualSwitch iSCSISwitch -PortGroup "iSCSI1"
PS C:\Users\Administrator> $IscsiManager = Get-View -Id $vmhost.ExtensionData.Configmanager.IscsiManager
PS C:\Users\Administrator> $IscsiManager.BindVnic($VMHostHba.Device, $NetworkAdapter.Name)
Exception calling "BindVnic" with "2" argument(s): "There is an error in the XML document."
At line:1 char:1
+ $IscsiManager.BindVnic($VMHostHba.Device, $NetworkAdapter.Name)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Any thoughts, on how to solve this issue.
Thank You