Get all VMs with Fixed MAC Addresses using PowerCLI
I needed a list of all VMs with a Fixed MAC Address running on vSphere (it works for ESX 3.5 as well).
Let’s build up this command from the beginning. We start with Get-VM to get a hold of all VMs.
Get-VM
This of course will list just any VM. So we need some filtering.
Find VMs with Mismatched OS using PowerCLI
Almost every environment has one or more VMs where the running OS doesn’t match what is configured on the VM.
Let me explain:
Every VM has a property which contains the OS version:
This is usually set when you create the VM. In this example, the VM is set to Windows 7 x64. But if you install an OS in the VM, VMware is also aware of the Guest OS through VMware Tools. This is visible on the Summary page of the VM.
Both fields should match, but if you upgrade the OS inside the VM and forget to change the Settings of the VM, you have a mismatch.