PowerShell: How to Get the footprint of your VMs

Our workloads run on VMs and containers, the proliferation of both sometimes is hard to track and even if we are using them for LABS or DEV/TEST/PROD environments monitor or measure it a key feature.
I will show you how easy is to stay on track with just few lines of powershell.

Let’s start with a single Hyper-V host. Get the footprint of a Virtual Machine can be simply obtained with a function like this:

Once defined, I can call it in a foreach loop. To get a better user experience I will also add Write-Progress as shown here:

With this end result:

If your environment leverages Microsoft Hyper-V more extensively with multiple nodes/hosts and obtain the same result sometimes can be tricky.

But using invoke-command there is no need to copy the previous powershell script on each host and we can simply run this one:

As usual this scripts are available on my github repository.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.