It’s possible to configure a Hyper-V host running core to be fully managed remotely. I have read various suggestions on the web saying it’s better and more secure to leave the Hyper-V host in a workgroup, but the effort required when doing that just doesn’t make it worth it in my opinion.
And we actually want 1st and 2nd line technicians to be able to do as much troubleshooting as possible before escalating, rather than adding complexity.
OK if you haven’t already run the following on the core server do it now:
1 |
[cc lang="powershell"]Enable-PSRemoting[/cc] |
If you don’t know the hostname, run the command now.
1 |
[cc lang="powershell"]hostname [/cc] |
All being well, that should be the last time we need to run commands locally on the core server. The machine you use to administer the core server must have the required Remote Server Administration Tools installed and, for ease of access, be a member of the domain.
So let’s connect to the host (obviously switch “oobehostname” for whatever the hostname of your machine is).
1 |
[cc lang="powershell"]Enter-PSSession "oobehostname"[/cc] |
Next, rename it specifying your credentials
1 |
[cc lang="powershell"]Rename-Computer -NewName "contosohv012" -DomainCredential contoso\admdel.griffith -Restart[/cc] |
Once the server has restarted, reconnect. Then you can either do
1 2 |
[cc lang="powershell"]Enter-PSSession contosohv012 Install-WindowsFeature -Name Hyper-V -Restart[/cc] |
Or to execute the command remotely
1 |
[cc lang="powershell"]Install-WindowsFeature -Name Hyper-V -ComputerName "contosohv012" -Restart[/cc] |
If you aren’t sure whether Hyper-V is installed or not, you can run
1 |
[cc lang="powershell"]Get-WindowsFeature -Name Hyper-V -ComputerName "contosohv012"[/cc] |
Next comes the firewall settings. This Microsoft document explains that to enable remote management of a 2016 core server you should run:
1 |
[cc lang="powershell"]Enable-NetFirewallRule -DisplayGroup "Remote Administration"[/cc] |
But this group was removed starting with Windows Server 2012. So instead I ran:
1 |
[cc lang="powershell"]Get-NetFirewallRule | select-object -expand DisplayGroup[/cc] |
to find the names of the services I needed. To allow access for each follow these steps:
Windows Firewall with Advanced Security
(I preferred just setting this on the Domain profile so I edited the rule first)
1 2 |
[cc lang="powershell"]Set-NetFirewallRule -DisplayGroup "Windows Firewall Remote Management" -Profile Domain Enable-NetFirewallRule -DisplayGroup "Windows Firewall Remote Management"[/cc] |
Services
1 |
[cc lang="powershell"]Enable-NetFirewallRule -DisplayGroup "Remote Service Management"[/cc] |
Event Viewer
1 |
[cc lang="powershell"]Enable-NetFirewallRule -DisplayGroup "Remote Event Log Management"[/cc] |
Shared Folders
1 |
[cc lang="powershell"]Enable-NetFirewallRule -DisplayGroup "File and Printer Sharing"[/cc] |
Performance Logs and Alerts
There are rules on each of the different profiles, so just the regular -DisplayGroup won’t cut the mustard here
1 |
[cc lang="powershell"]Get-NetFirewallRule | Where {$_.DisplayGroup -eq "Performance Logs and Alerts" -and $_.Profile -eq "Domain"} | Enable-NetFirewallRule[/cc] |
Disk Management
Disk Management is also a little more complicated. First run this on the remote machine:
1 |
[cc lang="powershell"]Enable-NetFirewallRule -DisplayGroup "Remote Volume Management"[/cc] |
Then run the same command on the local machine. Next, we need to start the virtual disk service.
1 2 |
[cc lang="powershell"]Set-Service -Name vds -StartupType Automatic Set-Service -Name vds -Status Running -PassThru[/cc] |
Now you should be able to connect computer management, and all other required mmc consoles by right clicking and choosing “Connect to another computer”.