2 Replies Latest reply on Feb 6, 2019 4:31 AM by PGinhoux

    How to exclude the IPV6 address from a list

    PGinhoux Novice

      Hi,

       

      I'm using the current script from LucD, I found in another discussion :

       

      Get-VM -PipelineVariable vm | where{$_.Guest.Nics.IpAddress} | Get-NetworkAdapter |


      @{N='VM';E={$vm.Name}},Name, @{N='VMHost';E={$vm.VMHost.Name}}, @{N=”IP Address”;E={$nic = $_; ($vm.Guest.Nics | where{$_.Device.Name -eq $nic.Name}).IPAddress -join '|'}}, MacAddress | Format-table -Autosize

       

       

      It works fine, but it shows the IPV6 address I would like to exclude :

       

      VM                   Name                   VMHost                   IP Address                                       MacAddress      

       

      --              ----              ------             ----------                           ----------      

       

      test-vm         Network adapter 1 esx03.domain.local fe80::b0fe:ab09:6b6:10f9|192.168.1.1 00:50:56:80:58:21

       

      Is it something possible ?

       

      Thanks in advance for the help.

       

      Regards

      Patrick