Powershell – Managing HyperV Server 2012R2 from Windows 10 powershell

hyper-v-server-2012-r2powershell

I have trouble managing hosts running HyperV Server 2012R2 (the standalone HyperV installation) through PowerShell on Windows 10. While I can connect to them via Hyper-V-Manager in Windows 10 and manage them just fine, when I try running powershell commands such as:

Get-VMHost <HyperVHostName>

or

Get-VMReplication -ComputerName <HyperVHostName>

Powershell returns

The Hyper-V module used in this Windows PowerShell session cannot be used for remote management of the server. Load a compatible version of the Hyper-V module, or use Powershell remoting to connect directly to the remote server.

The documentation the error message further points to leads to the basic remote management docs for Hyper-V 2012R2 found here:
https://technet.microsoft.com/en-us/library/hh846767(v=ws.11).aspx

The powershell commands work fine with Hyper-V Server 2016 as well as Windows Server 2016. Since I don't want to use PowerShell remoting to connect to each machine individually with a PowerShell session, I'd like to know what I can do to get managing HyperV Server 2012R2 from Windows 10 Powershell to work. Any ideas?

Best Answer

You can specify the version of the Hyper-V cmdlets you need, e.g. Import-Module Hyper-V -RequiredVersion 1.1

Windows remote management tools have typically been able to manage the same version server as where you ran the tool, plus two versions back. Internally it's referred to as "N-2" support.
The Hyper-V cmdlets don't do this directly, but they provided additional versions of their module that can be selected at need. Ben Armstrong's blog discusses it here: https://blogs.msdn.microsoft.com/virtual_pc_guy/2015/11/16/why-are-there-two-hyper-v-powershell-modules-in-windows-10/

You can see a general support list for Remote Server Administration Tools (RSAT) here: https://social.technet.microsoft.com/wiki/contents/articles/2202.remote-server-administration-tools-rsat-for-windows-client-and-windows-server-dsforum2wiki.aspx