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

Re: Detect VM with 4 network adapters and same NetworkName

$
0
0

In your 'foreach' loop, you can create a 2nd array of Network adapters.

 

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

 

And in theory you could write an if statement. You have the option to set additional variable names based on the index in the array or just specify the index in the if statement.

 

If ($myVmNetworkAdapters[2].NetworkName = $myVmNetworkAdapters[3].NetworkName) {     Do something (not sure what you want to do here)
}

 

Now I didn't test the syntax, but hopefully you have the idea.


Viewing all articles
Browse latest Browse all 168455

Trending Articles



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