Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 219257

Re: Simply trying to add VLANIDs to a column

$
0
0

The VLANid is not available in that object, you will have to fetch the VirtualPortgroup.

Try like this

 

Get-DataCentertestdata|Get-Clustertest|

Get-VM|

ForEach-Object {

  $ErrorActionPreference='silentlycontinue'

  $VM=$_

  $VM|Get-VMGuest|Select-Object-ExpandPropertyNics|

  ForEach-Object {

    $Nic=$_

    $vlan=Get-VirtualPortgroup-Name$nic.NetworkName -VM$VM

    foreach ($IPin$Nic.IPAddress)

    {

      if ($IP.Contains('.'))

      {    

        ""|Select-Object-Property @{Name='VM';Expression={$VM.Name}},

          @{Name='IPAddress';Expression={$IP}},

          @{Name='NetworkName';Expression={$Nic.NetworkName}},

          @{Name='VLANID';Expression={$vlan.VLanId}}

     }

    }

  }

}

 


Viewing all articles
Browse latest Browse all 219257


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>