1 2 Previous Next 25 Replies Latest reply on Feb 11, 2019 7:59 PM by jvm2016

    creating vmkernel port group_powercli

    jvm2016 Hot Shot

      Hi luc,

      good morning .

       

      there is a requirement of

      1:creating two distributed port groups

      2:and two vmkernel adapters (for vmotion and replication) per esxi in three node cluster.

       

      i thought of doing as below .could you modify orange code so that we can iterate over ips of vmotion and replication .

       

      function create-vmkernelport

       

      {

       

          [cmdletbinding()]

       

       

          param(

       

              [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]

       

              [string]$clustername,

       

              [Parameter(Mandatory=$true)]

       

              [string]$distributedswitch,

              [Parameter(Mandatory=$true)]

       

              [string]$vlanvmotion,

              [Parameter(Mandatory=$true)]

       

              [string]$vlanreplication,

              [Parameter(Mandatory=$true)]

       

              [string]$subnetmask

       

       

       

       

          )

       

          $cluster=Get-Cluster $clustername

         

       

          $vmhosts=get-vmhost -Location $cluster

          $ipvmotion = "172.16.8.21","172.16.8.22","172.16.8.23"

          $ipreplication = "172.16.9.21","172.16.9.22","172.16.9.21"

         

       

          $vmotion=New-VDPortgroup -name "vmotion_112" -VDSwitch $distributedswitch -VlanId 112 -PortBinding Static -NumPorts 8

           $replication=New-VDPortgroup -name "replication_113" -VDSwitch $distributedswitch -VlanId 113 -PortBinding Static -NumPorts 8

         

       

       

        

          foreach($vmhost in $vmhosts)

          {

        

        New-VMHostNetworkAdapter -VMHost $vmhost -PortGroup $vmotion

        -VirtualSwitch $distributedswitch -IP $ipvmotion[$i] -SubnetMask $subnetmask

       

       

        New-VMHostNetworkAdapter -VMHost $vmhost -PortGroup $replication

        -VirtualSwitch $distributedswitch -IP $ipreplication [$i] -SubnetMask $subnetmask

       

                 

                 

                 

              

              

           }  

           }   

        1 2 Previous Next