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.


I have a very old VMware ESXi server that has outlived its useful life. The hardware is at least 5 years old and my VMware license has expired. I can still bring up the server and see the virtual machines, but that’s about it. I still keep the box so I can run the PowerCLI cmdlets, at least in a limited fashion. However, there are a few virtual machines that I need to get at so I can move some applications and data to another Hyper-V virtual machine. Since I can’t get the VMware virtual machine running, I can at least convert the disk to a VHDX and bring it up in a new Hyper-V virtual machine.

I already have PowerCLI 6.0 and the Hyper-V cmdlets installed on my computer. My initial thought was to use the free Microsoft Virtual Machine Converter which you can download. But I ran into a number of issues using the GUI, primarily because not everything is in the same domain. But that doesn’t really matter because I didn’t really want to migrate the complete virtual machine, I just needed to bring up the old VM temporarily so I could migrate things off. Fortunately, there are a set of cmdlets that ship with Microsoft’s converter. Here’s what I did.

First, I needed to connect to my ESXi box using the PowerCLI cmdlets.

I need to get the disk files for a given virtual machine. One benefit of PowerCLI is that you can easily browse the datastore files.

I’ll need all of these files. But first I need to be able to access them from the file system. Fortunately, PowerCLI has a handly cmdlet for copying items from a datastore to the file system.

Once the files are copied I can begin the conversion. However, the Microsoft virtual machine converter cmdlets aren’t installed in an expected location so I’ll have to manually import them.

Once imported, I can use ConvertTo-MvmcVirtualHardDisk.

The conversion took about 20 minutes for a 40GB file. The converted file was 30GB for a dynamic hard disk. With the conversion complete, it is pretty easy to fire up a new Hyper-V virtual machine.

You’ll notice that I am using a complete path for the New-VM cmdlet. That’s because in my session I have both PowerCLI and Hyper-V cmdlets and they both have a New-VM cmdlet. Normally I wouldn’t have both running in the same session but since I do, I need to explicitly tell PowerShell which cmdlet to use.

And that’s about it. Once running I uninstalled the VMware Tools, installed the Hyper-V Integration Toolkit and let Windows detect everything else. This would require me re-activating Windows, but I’m hoping to migrate everything I need before that becomes an issue.


The Altaro PowerShell Hyper-V Cookbook

powershell-cookbook-ebook1 For awhile now I’ve been contributing to the Altaro Hyper-V blog. Many of my articles centered on managing Hyper-V with PowerShell. I’ve gone through my library of management tools and written an eBook around them. All of the PowerShell scripts and functions have been polished up a bit. The eBook briefly discusses how to you use each recipe. It is a cookbook after all.

All of the recipes have been tested, but even so you should test everything in a non-production environment. Every Hyper-V environment has its own quirks. Or you can use the recipes as jumping-off points for your own PowerShell and Hyper-V. When you download the eBook be sure to get the accompanying zip file of code samples.

Visit to learn more and download your free copy. I hope you’ll let me know what you think

InfoWorld: Automate Live VM Export

infoworldThis is kinda cool, but I got published in InfoWorld, in a roundabout manner. J. Peter Bruzzese writes a column for InfoWorld on enterprise Windows. His latest column is about exporting Hyper-V virtual machines using PowerShell. In Windows Server 2012 R2 (and Windows 8.1) you can export a virtual machine even while it is running. Peter wanted to demonstrate with a weekly and monthly scenario using PowerShell to export virtual machines to a new folder and also delete older versions. The end result would be a set of 4 weekly folders and 2 monthly folders. But he needed help with some of the PowerShell so I pulled together a script which is linked in the InfoWorld article.

The script I wrote is a bit more complicated than what Peter originally envisioned. Now, I doubt his goal could be accomplished with a one-liner. So since I needed to write a script, I took the time to make it robust with items such as error handling and parameter validation. I only wanted to develop the script once so why not be thorough?

As I as finishing up the script to Peter’s requirements, I realized this could also be tackled using a PowerShell workflow. One of the limitations in the original script is that it needs to run on the Hyper-V server. I didn’t include any provision for connecting to a remote server. I also recognized that exporting multiple virtual machines could be done in parallel. Although my original script allows the use of background jobs which is sort of like running in parallel. But I thought a workflow version might at least be educational. Here is the Export-MyVM workflow.

Most of the code is the same as the original script, although I removed the WhatIf parameter. You can’t use SupportsShouldProcess in a workflow and I didn’t have the time to fully write my own. The only code that is really workflow specific is this:

Perhaps the biggest advantage is that with a workflow I get automatic support for background jobs and remoting. Now I can execute the workflow against the Hyper-V server.

And I could still create a PowerShell scheduled job on my computer to run this workflow.

By the way, I’m sure you are aware that there are plenty of Hyper-V backup products from companies like Altaro, Veeam and Unitrends (all of whom help support my blog). Some of them even have free versions of their products. So while you can use PowerShell to export VMs that doesn’t mean you should. Although I can see value for a quick and dirty backup. Ultimately, I suppose it is a good thing to have options.