In the VMware vSphere Web Client, you can see quite a bit of information about your VMs including information about the guest operating system running. You can see how many network adapters you’ve added and you can see the IP Addresses configured if you have the VMware tools installed. But there is some disconnect between the MAC Address, the IP Address, and the Network Adapter. How do you know which IP Address is assigned to which Network Adapter, and how do you get the MAC Address? Is there a way to get the VMware guest NIC info?

If you refuse to get with the times and you’re a crabby patty that loves the fat C# client…I’m right there with you. Still holding on to 6.0 and getting more depressed every day as the clock ticks ever closer to the EOL support for 6.0 and the forced upgrade to 6.5, thereby relinquishing your grasp on the days of old. I feel your pain, I really do.

\\\Trustworthy Client

Alright, if you’re using vSphere 6.0, you’ll have the option of checking in 2 places: the C# client and/or the web client. Don’t worry, both will leave you with almost what you need.

I can get the MAC Address per network adapter here:

And assuming I have VMware Tools installed on the guest, I can get the IP Addresses here:

But how do I know which MAC goes with which IP?

Of course, you can connect to the guest OS itself to verify this, but where’s the fun in that? Besides, imagine if you needed the information from several VMs, or what if you didn’t have console access/permissions to the VM? Let’s see how we can get this information using PowerCLI.

\\\Power On

First, if you haven’t installed PowerCLI, you used to have to download it and install it and it was set up to launch a separate console which loaded the module…but my, how times have changed. Now, in the PowerShell Gallery, a young whippersnapper can simply use a couple of cmdlets to install the module from the Gallery:

Install-Module VMware.PowerCLI

I feel like saying something like, “back in my day…” but I’ll refrain. Once you have PowerCLI installed, let’s connect to our vCenter server (or ESXi host):

Connect-VIServer NameOfvCenterOrHost

\\\Enter the Rabbit Hole

Once we’re connected, let’s hit up a VM…preferably a VM with more than one NIC. I’m pretty sure you can connect the dots with only 1 MAC and 1 IP to match…

I have a fantastic example of a VM with 6 NICs. Let’s dive into it with the Get-VM cmdlet.

By default, I’ll only be returned 4 columns formatted as a table. Let’s go farther (just like this Isuzu commercial from 1998) and format as a list to see what else we have for this VM:

Get-VM nameofVM | fl

\\\Go Farther

Okay, that’s a bit more information to work with. I still don’t see the NIC info, but let’s drill down into the guest property and see what we find.

(Get-VM nameofVM).Guest | fl

Hmmm…The “Nics” property looks promising. Let’s continue our journey down the rabbit hole:

(Get-VM nameofVM).Guest.Nics | fl

Virtual gold mine! Hopefully your information isn’t blacked out like mine…but here is where we find the IP Address, MAC Address, and the Virtual Network of each Network Adapter and its status. With fantastic results like this, you’ll finally be able to move your server out of the bathroom and into a data closet in no time…


Index Scripts for Windows Search

So you just finished writing some code and you go to save your file. You summarize all of the important aspects this section of code contains into a nice, easy-to-read file name that your future self will immediately recognize. Fast forward to the future where you...

Array vs ArrayList (PowerShell)

For some tasks in life, being precise is a necessity. But most of us get away with rounding, paraphrasing, and hitting in the general vicinity most of the time. Depending on your personality, you may be one who strives for perfection and strains on every miniscule...

Spice Up HTML Emails with PowerShell – Part III

So far in this series we've fumbled our way around the kitchen and tried to wing it when sending HTML emails with PowerShell. It was clunky to say the least. We then went through our spice rack and built an HTML template, highlighting the nuances of each spicy element...

Spice up HTML Emails with PowerShell – Part II

In Part I of our scrumptious concoction we put our script into the oven to let it bake. But we forgot to add our secret sauce that's sure to leave our recipients drooling, which is clearly our goal. In this post we'll continue to spice up HTML emails with PowerShell...

Spice Up HTML Emails with PowerShell – Part I

I live in the South, specifically in God's country AKA TEXAS BABAY! There's plenty of amazing things about Texas and definitely some reasons to loathe being from Houston, but it's hard to knock our food. I mean, is there really even a debate between Whataburger vs...