Storage Migration + PowerShell + Windows “8” = Magic

Here is a neat trick that we figured out a little while ago.  With a single command you can organize all of your virtual machines:


The command is:

Get-VM | %{ Move-VMStorage $_.Name "D:\Hyper-V\$($_.Name)" }

This command gets each virtual machine on the server, and then performs a storage migration to move it to a folder under “D:\Hyper-V” that has the same name as the virtual machine itself.  It is amazing how powerful such a simple command can be, and it has become a staple tool for me to clean up a server that I have been messing around with virtual machine placement on.