6 Replies Latest reply on Nov 9, 2017 7:29 AM by LucD

    disabling vmotion traffic on management port_powercli(get-view)

    jvm2016 Enthusiast

      Hello Luc,

       

      could you check following code .this is to disable vmotion traffic on mangement port (vmk0) .

      this works fine but i wanted to develop using get-view .in your last post yu mentioned

      we can view esxi using -property name,config.network.vnic

       

      however issues i am getting is i dont see any nested properties corresponding to managementtrafficenabled and vmotionenabled

      also we need to find method corresponding to Set-VMHostNetworkAdapter -VMotionEnabled $false.

       

      i have been checking hostvirtualnic object in api documentation but did not find anything or iam not able to understand .need you help if following code can be converted using get-view way.

       

       

       

       

       

       

      $vmhosts=get-vmhost -location $cluster

       

      foreach($hos in $vmhosts)

      {

      $vmkernel=Get-VMHostNetworkAdapter -VMKernel -VMHost $hos|Where-Object{$_.managementtrafficenabled -eq $true -and $_.vmotionenabled -eq $true}

      $vmkernel|select @{N='esxi name';E={$hos.name}},@{N='vmkernel port';E={$_.name}}

      if ($vmkernel -eq $null)

      {

      Write-Output "nothing to remediate for traffic separation"

      }

      else

      {

      $rem1=read-host " do yu want to remediate traffic separation"

      }

      if($rem1 -eq "yes")

      {

      write-output "remediating traffic separation"

       

      $vmkernel|Set-VMHostNetworkAdapter -VMotionEnabled $false -confirm:$false

       

       

      }

       

       

      }