Automation

 View Only
  • 1.  iSCSI Port Binding

    Posted Feb 19, 2017 03:29 PM

    Hi Experts,

    I am trying to bind 2 vmkernal ports to iSCSI SW HBA. using powercli. ESXi v6.0, Powercli v6.5

    I found 2 examples how to do it, but both don't work:

    First way: Get-VMHost $VMhost | Set-VMHostiSCSIBinding -HBA $HBANumber -VMKernel $iSCSI_nic - it complain there is no Set-VMHostiSCSIBinding

    The second way:

    $esxcli = Get-EsxCli -V2 -VMhost $VMhost

    $esxcli.iscsi.networkportal.add($HBA, $Null, $vmk1number)

    or

    #$esxcli.swiscsi.nic.add($HBANumber,$vmk1number)

    It fails complaining "add" is not an option.

    Any help is appreciated.



  • 2.  RE: iSCSI Port Binding
    Best Answer

    Posted Feb 20, 2017 05:48 AM

    When you use the V2 switch on the Get-EsxCli cmdlet, the way of making the call is slightly different.

    See also PowerCLI 6.3 R1: Get-ESXCLI Why the V2?

    First do the following to get the layout of the hash table.

    $esxcli.iscsi.networkportal.add.CreateArgs()

    Then do the call (notice the Invoke that needs to be added).

    $iScsi = @{

        force = $false

        nic = 'vmk0'

        adapter = 'vmhba34'

    }

    $esxcli.iscsi.networkportal.add.Invoke($Iscsi)



  • 3.  RE: iSCSI Port Binding

    Posted Feb 21, 2017 01:50 AM

    Thank you so much LucD! Work like a charm!