Adding Some Power to Hyper-V VM Notes

Since I work at home, I rely a great deal on my Hyper-V environment. I’m assuming if you are using Hyper-V at work the same is true for you.  Because I do a lot of testing, it is difficult sometimes to remember what is running on a given VM. Did I update that box to PowerShell v5? Is that VM running Windows Server 2016 TP 3 or TP4?

Hyper-V virtual machines have a setting where you can keep notes which seems like the ideal place to store system information.  Since most of my Windows machines are on my public network and the virtual machine name is the same as the computer name, I can easily use PowerShell remoting to connect to each virtual machine, get some system information, and update the corresponding note.

I can run a command like this to get the system information I need.

I get back a result like this:

System Information
system information

In my code, I want to include the computer name just in case it is different. If the server has the Resolve-DNSName cmdlet, I invoke it otherwise I use the .NET Framework to resolve the name.

To set the the Notes property , I can use Set-VM.

Be aware that this behavior will replace any existing notes. In my final code, I take that into account and by default I append the system information. But there is a parameter to replace the note contents if you wish.

My final code also includes a parameter to use the VM’s IP address instead of it’s name. I have a few VMs that are not part of my test domain, but I register their names in my DNS.

Here’s the complete script.

Note that this is a script and not a function.  I can now easily update my virtual machines.

setting VM note
getting system information for the VM note

And here’s the result:

viewing the note
The new note

Of course you can modify the script to include any information you want in the note.

If you find this useful I hope you’ll let me know.



I have updated the script and turned it into a function. You can now pipe virtual machines into the function. I also included a Passthru parameter so you can see the Note information. The function is hosted on GitHub at

What Are You?

Here’s a quick way to tell whether a given machine is real or not: check the Win32_Baseboard class. You can use either Get-WmiObject or Get-CimInstance. Notice the results from a few physical machines.

Now see the result when querying a Hyper-V virtual machine:

I don’t have any VMware available so I don’t know what kind of result that would show. I also haven’t done extensive testing with items like a Microsoft Surface. I threw together this simple function you could use.

Have fun.

Hyper-V Memory Utilization with PowerShell

I really push the limits of my Hyper-V setup. I know I am constrained by memory and am hoping to expand my network before the end of the year. But in the meantime I have to keep close tabs on memory. I thought I’d share a few commands with you. I am assuming you have the Hyper-V module installed locally. You don’t have to be running a hypervisor in order to use the PowerShell commands to manage a remote server. Or you can take my commands and run them remotely via a PSSession or Invoke-Command.

First off, I only need to get virtual machines that are currently running.

This command is using the newer Where-Object syntax. Here’s a sample result.

Memory usage for running VMs

Or I can use the newer Where() method in v4 which performs better. I’ll get the same result.

The memory values are in bytes which I’m never good at reformatting in my head, so I’ll PowerShell do the work.

Formatted values

You know what? I want to take this a step further, which is usually my inclination. I think it would be useful to also see what percentage of assigned memory is being demanded. I can calculate this percentage and round to 2 decimal places.

Memory utilization with percentage

That should give me all of the data I need. The last step is to format the results into an easy to read report.

Formatted VM memory report

I can take this code and turn it into a script or function to save some typing. Perhaps even parameterize for the computername. I have some other thoughts as well which I hope I can get to at some point. But for now clearly I have some issues on my Hyper-V server, CHI-HVR2, to attend to.


More Power Scotty!

Many of you have seen my travel with my Yoga 2 Pro laptop and a Gigabyte Brix running Hyper-V with 16GB of RAM and a 240GB msata drive. I use these rigs for demos when traveling and they also provide me with a test domain network. But lately I’ve started feeling some constraints. Even though I run the VMs lean and often use server core, I can’t run as many VMs simultaneously as I would like or at the level they really need.

My current setup
My current Yoga 2 and Brix setup with a Netgear switch

For example, I’m trying to do a bit more with System Center which requires SQL Server, another product I’m delving into more as well, and those servers really need a bit more in terms of resources. I would also like to re-introduce a WSUS server, Sharepoint and Exchange 2013. By my preliminary estimates I need a minimum of 36GB total memory spread among multiple Hyper-V servers. Plenty of disk space as well but that seems to be easy to address. I also want a second Hyper-V server so I can do more with migrations and replications.

So I’ve been considering what I could build to add to my existing setup. I am hoping to have a solution that gives me at least 32GB of RAM to divvy up. My initial thought was to add one or two more Brix units. I could build a new 5th gen i7 with 16GB RAM and a 500GB Samsung EVO drive for about $878. If I double up my investment is $1756. That’s not too bad.

I considered going the laptop route, perhaps by adding a new Lenovo what supports 32GB of RAM. That seems to start pushing the price up.

I’m also considering making a quantum leap of sorts into a server class motherboard like the Supermicro X10SDV-F-O Intel Xeon D-1540. Pricy for sure, but I could start with 32GB of RAM for around $300 and there is lots of room for storage. I’ve spec’d out a build at just around $2000. What I like is that I can cram everything into a mini-ITX form factor.

I’m finding plenty of pros and cons for all my options and haven’t made a final decisions yet. I’m certainly open to suggestions and feedback.  I realize whatever route I go will entail some packing changes should I need to travel with everything. My backpack is getting a bit heavy as it is already. But I’ll deal with that when the time comes.

For now I’ll have to decide which investment makes the best long term sense.

Creating a Hyper-V VM Memory Report

I use Hyper-V to run my lab environment. Since I work at home I don’t have access to a “real” production network so I have to make do with a virtualized environment. Given budgetary constraints I also don’t have a lot of high end hardware with endless amount of RAM and storage. So I often run my virtual machines with a bare minimum of memory. Most of the time this isn’t a problem. Still, there are times when I need to quickly see how much memory I’m using up. I can use either the Get-VMMemory or Get-VM cmdlet.

The latter cmdlet includes a bit more detail.

All of the values are in bytes which I know I could convert to MB with a custom hashtable. But I don’t want to do that all the time so I created a command to get detailed virtual machine memory.

I’ve posted versions of this function over the last few years so you may have come across earlier iterations. The major changes in this version is that I’m calculating a utilization percent of memory demand vs assigned. I also added a switch to only show virtual machines with a Low memory status, since often that’s the most important thing I want to know.

Now I can easily get information for a single VM

Or multiple:

Clearly my SQL Server needs a little attention.

I hope you’ll try it out and let me know what you think.