Performing bulk configuration changes with PowerShell in Hyper-V on Windows “8”

Over the weekend I noticed that one of my Hyper-V servers was running tight on memory.  I did not want to move any of the virtual machines off of the server – so I decided to reduce the memory buffer on each of my virtual machines.  At first I started using the graphical user interface to change the setting on each of the virtual machines.  After a moment I realized that I could do this much more quickly in PowerShell by simply running Get-VM | Set-VMMemory –Buffer 10:

PowerShell cmdlet: Get-VM | Set-VMMemory -buffer 10

Once this was completed – I immediately jumped back into the GUI to check all my virtual machines had been updated.  Once again I realized that this could be done more quickly through PowerShell by running Get-VM | Get-VMMemory | ft VMName, Buffer:

PowerShell cmdlet: Get-VM | Get-VMMemory | ft VMName, Buffer

Now, normally PowerShell cmdlets do not return results just to confirm that things actually succeeded (they only display error messages).  But if you are paranoid like me – you can get a command to display an output by using the “passthru” option like this:

PowerShell cmdlet: Get-VM | Set-VMMemory -buffer 10 -passthru | ft VMName, Buffer

Cheers,
Ben