Skip to content

Commit d1b8ba6

Browse files
authoredJun 2, 2023
show_nic.sh
Shell Script to show active VMNIC for a VM. Validate load balancing across Active/Active VMNICs in a vSwitch.
1 parent fb522c1 commit d1b8ba6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 

‎show_nic.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
# Get the list of VMs
4+
esxcli network vm list | awk 'NR>2' > /tmp/vmlist
5+
6+
while read -r line; do
7+
WorldID=$(echo $line | awk '{print $1}')
8+
VMName=$(echo $line | awk ' {print $2}')
9+
PortList=$(esxcli network vm port list -w $WorldID)
10+
NICID=$(echo "$PortList" | grep "Team Uplink:" | awk '{print $3}')
11+
MACID=$(echo "$PortList" | grep "MAC Address:" | awk '{print $3}')
12+
echo "VM: $VMName NIC: $NICID MAC: $MACID"
13+
echo "For more Details: esxcli network vm port list -w $WorldID"
14+
done < /tmp/vmlist
15+
16+
# Clean up the temporary file
17+
rm /tmp/vmlist

0 commit comments

Comments
 (0)
Please sign in to comment.