7

How do I connect to my Hyper-V 2016 standalone via my Windows 10 laptop?

Background: I'm setting this up as a home lab. I've followed a few guides, but I have not yet found a guide/Youtube tutorial that seems to work for the free edition of Hyper-V 2016. This is a "hello world" for Hyper-V standalone, and I can't find a guide that works for 2016. (Hyper-V 2012 + Windows 8 seems to have some automated scripts that solve the problem, but not for Hyper-V 2016.)

Context

  • Server: Hyper-V server 2016 (free, standalone), fqdn: server.local,
  • Client: Windows 10 Professional
  • Additional Notes
    • Client's etc/hosts file contains an entry for the server's fqdn
    • Neither client or server are on a workgroup or domain
  • My objective: remotely manage server using client's Hyper-V Manager

The error

An error occurred while attempting to connect to server "server.local". Check that the 
Virtual Machine Management service is running and that you are authorized to
connect to the server. 

Hyper-V encountered an error trying to access an object on computer 'server.local' because 
the object was not found. The object might have been deleted. Verify that the Virtual 
Machine Management service on the computer is running.

What I've done on the server

# sconfig.cmd: Enable "Configure Remote Management"
# sconfig.cmd: Add Local Administrator
# sconfig.cmd: Enabled Remote Desktop
Enable-PSRemoting
Enable-WSManCredSSP -Role server
sc start vmms                                  # Is this the "missing object"?
netsh advfirewall set currentprofile state off # Let's try disabling firewall

What I've done on the client

Set-Item WSMan:\localhost\Client\TrustedHosts -Value "server.local"
Enable-WSManCredSSP -Role client -DelegateComputer "server.local"
# Changed group policy: "Computer Configuration > Administrative Templates > System > Credentials Delegation > Allow delegating fresh credentials with NTLM-only server authentication" by doing: "Click Enable and add wsman/fqdn-of-hyper-v-host."
# Disabled firewall
# dcomcnfg > COM SECURITY > Access Permissions > Edit Limits > Anonymous Login > ALLOW Remote Access
cmdkey /add:YOURSERVERNAME /user:USERNAMEONTHESERVER /pass:THEPASSWORDOFTHATUSER

How I triggered the error

On the client:

  1. Launch "Connect to Server"
    1. Attempt one: "Set 'Another computer:' to '192.168.10.2'"
    2. Attempt two: "Set 'Another computer:' to 'server.local'"
  2. Click "OK"
  3. (error: "An error occurred while attempting to connect to server 'server.local'...)
montooner
  • 411
  • 1
  • 3
  • 12
  • On the workstation there should be no reason to install the Hyper-v platform? Just the management tools? On the workstation: Add-WindowsFeature Hyper-V-Tools Add-WindowsFeature Hyper-V-PowerShell Should install management tools only. – Lars Christensen Mar 07 '18 at 13:42
  • @LarsChristensen Yup, you're right. The workstation does NOT need the *platform*. It only needs *management tools* – montooner Apr 24 '18 at 07:23

1 Answers1

21

Found my specific issue :) I was using an invalid hostname, and the DNS wasn't resolving properly.

  • WRONG: server-1.local
  • RIGHT: server-1-local

But on a different note, I also found that the Microsoft doc (Remotely manage Hyper-V hosts with Hyper-V Manager) didn't document all the instructions necessary for me to make things work. It was mostly correct, but was missing one step. So I've attached my manual setup instructions.

See below for my full setup instructions for remotely managing Hyper-V 2016 via Windows 10 Professional. My setup involved two separate physical machines - I install both systems from scratch.

On the Hyper-V server

  1. Install Hyper-V Server 2016 (via GUI)
  2. Set password Note: change following in the terminal gui running sconfig
  3. Set computer name (e.g. server-1); note: do NOT use periods
  4. Configure remote management (disabled => enabled)
  5. Remote Desktop (disabled => enabled)
  6. In the Powershell window, run as admin:

Powershell commands:

Enable-PSRemoting
Enable-WSManCredSSP -Role server

On the desktop/laptop you're going to manage Hyper-V remotely

  1. Install Windows 10 Professional/your drivers/your apps (GUI)
  2. Change your network adapter setting
    • If on older patches of Windows 10
      • Click Start > Search "Homegroup" > Launch "Homegroup"
      • Click on the link to change network type (public => private)
    • If on newer patches of Windows 10
      • Try this: go to "Start Menu > (type) 'Ethernet' > (click) Ethernet adapter > (click) Private"
  3. Add a DNS entry in your hostfile (run notepad as Administrator)
    • Edit "C:\Windows\System32\drivers\etc\hosts"
    • Add an entry like "192.168.100.2 server-1"
  4. In the Powershell window, run as admin:

Powershell commands:

Enable-PSRemoting
Set-Item WSMan:\localhost\Client\TrustedHosts -Value server-1
Enable-WSManCredSSP -Role client -DelegateComputer server-1
Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All
cmdkey /add:server-1 /user:Administrator /pass

Note

The official Microsoft documentation was missing the cmdkey instruction, which registers the login info necessary to get into the Hyper-V server. I found it in a separate doc.

montooner
  • 411
  • 1
  • 3
  • 12
  • 2
    This is excellent, and as pointed out, the official docs are missing the `cmdkey` command, which really was _key_, haha. I also found that this works without the `Enable-WSManCredSSP -Role server` command on the server, as long as the network profile is private. – Nikhil Dabas Feb 18 '18 at 13:07
  • Not sure what are you talking about on those "homegroup" settings, but I still have to do the following `winrm set winrm/config/client '@{TrustedHosts="machineA,`machineB"}' ` in order to get it to work. – CharlesC May 05 '18 at 22:53
  • Thank you very much. I've been looking for using Hyper-V server in a while, but all tutorials failed at some point. Yours was the only one that worked flawless. Thank you again and again!!!! – lucasmx Jun 14 '18 at 14:09
  • If anyone is getting errors like "Access denied. Unable to establish connection between 'server-name' and 'PC-name'.", you might need modify some component services. Here is what I did - windows + r > dcomcnfg > computers > right click on properties > access permissions > edit limits. Set Remote Access for Anonymous Logon to Enabled. – Frank Fu Jul 04 '18 at 02:14
  • Thanks Microsoft, homegroup has been removed in recent windows 10 update, so this answer is outdated. https://support.microsoft.com/en-us/help/4091368/windows-10-homegroup-removed – Bob Jordan Sep 23 '18 at 03:30
  • @bmjjr Try this: go to "Start Menu > (type) 'Ethernet' > (click) Ethernet adapter > (click) Private" – montooner Oct 01 '18 at 06:31
  • `Get-NetConnectionProfile -NetworkCategory "Public" | Set-NetConnectionProfile -NetworkCategory Private` – FreeSoftwareServers Mar 10 '20 at 03:23
  • If you get hung up on "smart card reader" error, the last cmdkey command is meant to literally have /pass at the end, not to be replaced with the password. You will be prompted for password after entering this command – TechnoCore May 20 '21 at 21:44