Managing Hyper-V Standalone with OSX

Hyper-V server is the free virtualization OS from Microsoft to compete head to head with the free ESXi OS. When running in large farms or domain joined, Hyper-V seems to work pretty decently. But when you just want a single host that you manage with Windows 10, or let alone MacOS, Hyper-V can become a nightmare.

So why would you go the Hyper-V route and not the ESXi route in that case? Well.. ESXi has a very specific taste for hardware. Only certain raid controllers, certain NIC’s etc are supported. While Hyper-V based on the Windows 2016/2019 OS usually gives you more freedom to play around with, and it supports RAID straight from the software. So essentially, you can run it on almost any white box,.

In this post I’ll be installing Hyper-V server on my Dell T710 as a single-stand-alone machine, while configuring it solely from a MacOS based laptop.

First things first, download Hyper-V 2016. You could opt for the 2019 version, but there are some quirks on that one with regards to RDP, which we will need when we are configuring it. (so much for the good start). I installed the 2016 version on Disk 0, an SSD that is attached to a standard SAS/SATA controller. After the installation, set the password for the administrator account on the console.

And after logging in, enable RDP by typing 7 <enter>, E <enter>, 1 <enter> <enter> on the pop-up.

Next we need to know the IP of the server so we can connect to it: Type: 8 <enter> and note the IP listed:

Then on your Mac, download the latest Microsoft Remote Desktop application and create a connection to the server.

On the application, select the + and then select Desktop. On the PC Name field enter the IP address and click save. Your connection will be saved under Saved Desktops. Double click and login with administrator/<password set>. On the pop-up regarding a certificate validation, click continue.

You will now have the remote desktop loaded on your Mac. First things first, lets get the updates by issuing 5 <enter>, D (download only) <enter> . Then 6 (download updates), A (all updates) and have the system update itself.

In my server I have a custom NIC for which the drivers are not loaded by default. I’ve been working on the on-board QLogic NIC for now, but I wanted to enable my 2x 10Gb SFP (HP HC523SFP) NIC as well. So, in case your NIC did not load either, through the console (as RDP would not work if you don’t have any connection), follow the next steps.

NIC Drivers

In my case, the NIC driver is actually an executable that extracts itself and starts the installer, but in my system, the drivers are for 2012R2, not 2016 and thus the auto installer doesn’t work. We have to go the old-school route of installing the drivers.

First, the extraction. The extract only of the software doesn’t work and as I promised I’d only use MacOS we can’t extract them on there either. So, we run the installer, but leave the error message in the background while we grab the extracted files:

The temporary files location can actually be found in the log file under c:\cpqsystem\log

Once we grabbed all the required files, we can now do pnputil.

PNPUTIL.exe -i -a c:\installs\qlnd6x64.inf 

And let’s see if we have additional NIC’s by doing an ipconfig/all (or even better, issue PowerShell and then type Get-NetAdapter)

Remote Control of the server

In order to create and manage VM’s we could opt for a full PowerShell based management. But given we’d have to RDP constantly into the server (from MacOS), it’s probably easier to install the Windows Admin Center.

For this, download the admin center toolkit: https://www.microsoft.com/en-us/cloud-platform/windows-admin-center put it on a USB drive to copy it to the server (or open a share or any other means of copying it to the server) and from a command prompt in the server run:

msiexec /i c:\temp\WindowsAdminCenter1804.msi /qn SME_PORT=443 SSL_CERTIFICATE_OPTION=generate

This will install the Admin Center on port 443 on the server quietly. Wait for a few moments and then using the browser on the Mac go to https://server and login using the server credentials.

Once the admin center is loaded, you can go to the Hyper-V section and create / manage VM’s. On the file-services tab you can also upload/download files straight into/from the server

Disks

The next part is getting the disks into a storage pool. This is required when you have multiple disks and no hardware raid controller (or you want to have the freedom to change the disk pool quickly). You can do this via the admin center (Storage) or through PowerShell as I do in this example:

In order to get all our disks into the pool, we create an array of all the disks that are available for the pool:

$disks=Get-PhysicalDisk  -CanPool $true 

Then we create the storage pool:

$pool=New-StoragePool -FriendlyName Pool1 -PhysicalDisks $disks -StorageSubSystemFriendlyName "Windows Storage*"

Once we have the pool, we create a new volume on that and set the volume to a stripe level. You can select Simple (no redundancy, max performance), Mirror, and Parity (raid 5 or 6).

In my case, I’m just setting up a mirror, using maximum size

New-Volume -StoragePoolFriendlyName Pool1 -Driveletter V -FileSystem NTFS -UseMaximumSize -ResiliencySettingName Mirror -FriendlyName VMs

And that created and formatted our V: drive for storage of VM’s. Let’s create a VM folder and Virtual HardDisk Folder and set the defaults to those folders:

Mkdir 'v:\Virtual Hard Disks'
Mkdir 'v:\hyper-v'
Set-vmhost -VirtualMachinePath 'v:\hyper-v' -VirtualHardDiskPath 'v:\virtual hard disks'

Networking

So now that the storage is done, let’s create the Virtual Switch. Again, you can do this via the Admin Center, but through PowerShell it’s just as easy…

In my case I want to enable the switch with my 2x 10Gb NIC’s, using Get-Netadapter I’ able to retrieve my Ethernet friendly names and I can create the switch using the following command:

New-VMSwitch -Name vSwitch -AllowManagementOS $true -NetAdapterName 'Ethernet 8','Ethernet 7' 

If you have dedicated NIC’s for just the VM’s you can set the AllowManagementOS to $false

Remoting into the VM’s

Given we set the challenge to only work on a Mac, you will notice that connecting to VM’s is not directly possible. Even with the official Microsoft Remote Desktop software available for OSX. But fear not, another company has released an application that does work. It is called RoyalTSX and its available for Windows and Mac. While the suite itself can do much more, we only need the free version of the software.

There are 2 ways to connecting to a VM. The Console (the usually screen+keyboard of a machine) or remote access (either RDP, PowerShell,etc for Windows, or SSH for Linux). In this case, we want to get to the console. And RDP for Hyper-V allows us to do so by connecting to the host with an InstanceID. In order to get the instance ID, go to your VM in the Admin Center console and select More to download the RDP file:

If you open the RDP file, you will notice a GUID if you open the downloaded file with a text editor. You can also find the GUID quickly on the Summary view of the Virtual Machines (which lists changed/started/created VM’s). Copy the GUID and open Royal TSX. Under Remote Desktop create a new entry with the name of the VM. For the Remote Desktop entries, put the name/ip of the server and port 3389.

Then scroll down to Hyper-V and put in Hyper-V host, connect to a specific instance. Put in the port 2179 and put in the InstanceID:

Then apply and close and connect.

And done!

Tagged ,