More Network Info
Following my previous network information script I was asked to add the VSwitch, so here it is…
The following script will add some nice host network information into an object which is exported to a csv file for passing to the network guys or can be used to find your server in that mess of cables that are always meaning to be tidied in the data center.
You will get:
- Host
- VSwitch
- VSwitch Ports (Added for @gabvirtualworld)
- VSwitch Ports in use (Added for @gabvirtualworld)
- Physical Nic Name
- Speed
- MAC
- Switch Device ID
- Port ID
- Observed Network ranges
- VLAN’s
Missing anything ?!
Sample output:
![]()
PowerGUI – Get started the easy way VI Toolkit Quick Reference Guide











There seems to be a bit of a bug. When I run the script it runs fine until it gets to host, where one of the vmnics is not assigned to a vSwitch. From that point on it just duplicates the details of the last port down the spreadsheet.
Try removing a vmnic from one of your hosts and run it again.
That’s strange, as you can see from my sample output there are hosts with nics not attached to VSwitches and it continues on.
OK, very weird. I just ran it again and its fine. Please ignore this (and delete the post if you like), while I try to figure out what was different).
forbes, thats fine, let me know if you work it out. Thanks for taking the time to read my blog !
Hi, I just noticed something very interesting. This script actually gives the “observed” VLANs, not just the port group VLAN IDs you set on the vSwitches. This is something that you can’t get from your VI client (it only provides observed IP ranges). Looking at the code, I assume that it doesn’t get this via CDP, but from listening to the traffic. Obviously you have to be careful with this type of data, however I think this is a real bonus to the tool. Very useful for troubleshooting network issues! Thanks
Well, since you’re asking for feedback – it would be great to see the load balancing method (# “Route based on originating virtual port ID”, “Route based on source MAC hash”, “Use explicit failover order”, or “Route based on ip hash”) and link failure detection method (Beacon or Link).
This should be listed for each vSwitch and the port groups should list if they use the vSwitch settings or if it is being overridden.
Also for the vSwitch and port groups if each vmnic is active or standby.
I wonder if we can use this to make a tool like RANCID http://en.wikipedia.org/wiki/RANCID?
I like your blog. Keep up the great work. very useful. Thanks!
I b e n
Iben, Thanks for your kind words, you have some great Ideas there, something for me to tackle when I return from VMworld.
I like the idea of turning it into a tool, might even add a GUI, I have been looking for an excuse to try PrimalForms.
The other additions are great, they will definately be added.
Something that would be useful to add, in addition to number of vSwitch ports, is the number of vSwitch ports that are still available. While this hasn’t been much of a problem since the ESX 2.x days (when there were only 32 ports per vSwitch – period) – I can certainly see it becoming more of an issue as people are beginning to stack up 50, 60, or more VMs per host…
[...] There is also some more advanced network information available via this script. [...]
great script!
Is it possible to add the load balancing setting for each vswitch? Ip_hash, src_id etc? I’ve been trying to do this myself but not having much luck so far.
[...] I strolled over to Alan Reneuf's website (www.virtu-al.net). I had remembered seeing a script ("More Network Info") he created that I knew could collect the info we wanted. Thank you, [...]
I have 2 ntp servers:
10.10.10.80
and
10.10.10.85
How should i define the $ntpserver ?
ooops excuse… me this was meant to be posted in the vcheck5.ps1
No probs Fred, answered in vCheck comments