In an attempt to connect to a remote Hyper-V host I needed to enable PowerShell Remoting.
To enable this you simple run PowerShell as Administrator and issue the following command:
Enable-PSRemoting
The command runs and then errors with the following output:
PS C:\WINDOWS\system32> Enable-PSRemoting
WinRM has been updated to receive requests.
WinRM service type changed successfully.
WinRM service started.
Set-WSManQuickConfig : <f:WSManFault xmlns:f=”http://schemas.microsoft.com/wbem/wsman/1/wsmanfault” Code=”2150859113″ Machine=”localhost”><f:Message><f:ProviderFault
provider=”Config provider” path=”%systemroot%\system32\WsmSvc.dll”><f:WSManFault xmlns:f=”http://schemas.microsoft.com/wbem/wsman/1/wsmanfault” Code=”2150859113″
Machine=”workstation.jermsmit.com”><f:Message>WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change
the network connection type to either Domain or Private and try again. </f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:116 char:17
+ Set-WSManQuickConfig -force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand
To correct this I opened another PowerShell window, also running as Administrator issue the following command to change each of the network interfaces to be private.
Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private
At this point I was able to run the Enable-PSRemoting without error
PS C:\WINDOWS\system32> Enable-PSRemoting
WinRM is already set up to receive requests on this computer.
WinRM has been updated for remote management.
Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.
WinRM firewall exception enabled.