PowerCLI: Determine vSwitch vmnic for your VM

From VI-Toolkit
Jump to: navigation, search

Determine vSwitch vmnic for your VM

author: Matt Boren

Description

Script that lists all the VMs with vmnic uplink and vSwitch for a selected host.


Usage

PS vNuggs:\> Get-VNUplinkNic -VMHostToCheck somehost
 
Need credentials to connect to VMHost
Please enter credentials for 'somehost'
User: root
Password for user root: *************

VMName         TeamUplink   vSwitch     VMHostName
----------     ----------   -------     ---------- 
Management     n/a          vSwitch0    somehost
vmk1           vmnic0       vSwitch0    somehost
vmk0           vmnic0       vSwitch0    somehost
dev0-vm0       vmnic0       vSwitch0    somehost
dev0-vm12323   vmnic5       vSwitch0    somehost
dev0-vm2       vmnic5       vSwitch0    somehost
dev0-vm32237   vmnic4       vSwitch1    somehost
dev0-vm9       vmnic8       vSwitch1    somehost
...

Location

http://vnugglets.com/2013/01/determine-vms-uplink-vmnic-on-vswitch.html