Use ‘standard’ Powershell to query SCVMM & Hyper-V

I came across this issue recently; not a biggie, but for the life of me couldn’t work why a simple scheduled PS Script wouldn’t return the info I wanted, when it worked in the SCVMM PowerShell Console.

Turns out that that the version of PowerShell called from the SCVMM console includes an important snap-in not loaded by default. To convert a standard PS Script to run against SCVMM simply load the following snap-in:

Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager

You will then be able to process all the Hyper-V commands. Pretty simple really but tripped me up for a bit.

A free Microsoft guide to managing Virtual Machines via SCVMM and PowerShell can be found at: http://bit.ly/ecAD5M