Quantcast
Channel: VMware Communities : Discussion List - Automation Tools
Viewing all articles
Browse latest Browse all 9071

Detect VM with 4 network adapters and same NetworkName

$
0
0

Hi All,

 

I’m trying to write a script which will find all servers with 4 network adapters and their 3rd and 4th adapter have the same NetworkName(VLAN).

 

I want to have output with:

Server name

NetworkName (the name of the network which is the same on the 3rd and 4th NICs).

 

I wrote something, but I can't find if 3,4 NIC NetworkName is the same:

 

$ArrayVMS4Nics = Get-VM | Where {$_.PowerState -eq "PoweredOn"} | Select Name, @{n="NumNICs"; e={(Get-NetworkAdapter -VM $_ | Measure-Object).Count}} | ?{$_.NumNICs -eq 4} | Select Name -ExpandProperty Name 

foreach($vm in $ArrayVMS4Nics)

{

  Get-VM $vm | Get-NetworkAdapter | select NetworkName, Parent

}

 

 

Thanks for any help or advice.

 

EddieM


Viewing all articles
Browse latest Browse all 9071

Latest Images

Trending Articles



Latest Images

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