Tag: Host

How to Install a Windows Server Container Host

How to Install a Windows Server Container Host

In this blog post, I want to quickly guide you through how you can install a Windows Server Container Host running Docker. This guide will help you set up, install, and run Windows Containers on Windows Server. In my example, I will install a container host on a Windows Server, version 2004, which is a Semi-Annual Channel (SAC) release. Windows Server SAC releases are released twice a year and are optimized for containers. In the Windows Server, version 2004 release, the team continued improving fundamentals for the core container platform such as performance and reliability.

If you want to learn more about the differences of Windows Server Semi-Annual Channel (SAC) vs. Long-Term Servicing Channel (LTSC), check out my blog post.

Requirements

  • A virtual or physical server running Windows Server 2016 or higher (Also including Semi-Annual Channel (SAC) releases. In my blog post, I will use the latest available releases and run the latest Windows Server SAC release, which offers the latest enhancements on the container host.
  • You can also use the Windows Server 2019 LTSC version

Set up and install the Windows Server Container Host

Since I am using the latest SAC release of Windows Server, the server is available as Windows Server Core only. This means I am going to use a tool called “sconfig” to set up my server for the first time. Of course, you can also use existing methods like unattend.xml files or PowerShell scripts to set up your server.

Windows Server Core

Windows Server Core

With sconfig, you can run all the simple configuration tasks to configure your Windows Server.

Windows Server SCONFIG

Windows Server SCONFIG

After the Windows Server is configured and patched, we can now install Docker, which is required to work with Windows containers. Docker consists of the Docker Engine and the Docker client. You can simply install Docker on Windows Server using the following commands.

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider
Install Docker on Windows Server

Install Docker on Windows Server

After these commands, you will need to restart the server.

Restart-Computer -Force

If you want to learn more about installing Docker on Windows Server, check out Microsoft Docs.

Run Windows Container Docker Images on Windows Server

Run Windows Container Docker Images on Windows Server

Now you can start pulling your docker container images to your Windows Server. I will use the latest Windows Container images, which came with Windows Server, version 2004. You can read more about the improved container images here.

docker pull mcr.microsoft.com/windows/servercore:2004 
docker pull mcr.microsoft.com/windows/nanoserver:2004 
docker pull mcr.microsoft.com/windows:2004

You can now use the docker client to manage your containers on your Windows Server, or you can also use the new Windows Admin Center Container extension, which was released a couple of weeks ago.

Manage Windows Server Containers with Windows Admin Center

Manage Windows Server Containers with Windows Admin Center

And yes, if you have a standalone Windows Server Core, you can also directly install Windows Admin Center on your Windows Server Core.

Conclusion

I hope this blog post gives you a great overview of how to install and set up a Windows Server container host. If you have any questions, feel free to leave a comment.



HCSDiag.exe - Hyper-V Host Compute Service Diagnostics Tool

HCSDiag.exe – Hyper-V Host Compute Service Diagnostics Tool

As you know, Hyper-V is not just a server virtualization software anymore. Today, you can find Hyper-V technology across different operating systems, products, and services, like Windows Defender Application Guard, Windows Sandbox, Hyper-V Containers, or many more. Thanks to Ben Armstrong from the Hyper-V team, I found out that there is a tool in Windows to troubleshoot these Hyper-V containers called hcsdiag.exe or Hyper-V Host Compute Service Diagnostics Tool. The Hyper-V Host Compute Service Diagnostics Tool (HCSDiag.exe) is available in Windows 10 and Windows Server 2019 if you have the Hyper-V roles or virtualization features enabled, and can be helpful to troubleshoot Hyper-V containers, virtual machines (VMs), Windows Sandbox, Windows Defender Application Guard, Windows Subsystem for Linux 2 and more.

HCSDiag.exe - Hyper-V Host Compute Service Diagnostics Tool

HCSDiag.exe – Hyper-V Host Compute Service Diagnostics Tool

Let’s have a look at the HCSDiag.exe, which you can find in C:\Windows\System32. It provides you with a couple of different commands and options. However, keep in mind that not all features work with every type of container. Some features are limited to scenarios where the VM is being used under the same user context as the host, where it is all about protecting the host from the guest and not the guest from the host like in the server version of Hyper-V.

To install Hyper-V, check out the following posts:

HCSDiag.exe

hcsdiag <command> [options…]

  • list
    Lists running containers and VMs.
  • exec [-uvm] <id> <command line>
    Executes a process inside the container.
  • console [-uvm] <id> [command line]
    Launches an interactive console inside the container.
  • read [-uvm] <id> <container file> [host file]
    Reads a file from the container and outputs it to standard output or a file.
  • write [-uvm] <id> [host file] <container file>
    Writes from standard input or a host file to a file in the container.
  • kill <id>
    Terminates a running container.
  • share [-uvm] [-readonly] [-asuser] [-port <portnumber>] <id> <host folder> <container folder>
    Shares a host folder into the container.
  • vhd [-uvm] <id> <host vhdx file> <container folder>
    Shares a virtual hard disk file into the container.
  • crash <id>
    Forces a crash of the virtual machine hosting the container (only works for containers hosted in a virtual machine).

I will give you some examples of how you can use hcsdiag.exe to interact with some of the Hyper-V containers. Now again, this focuses mostly on technologies like Windows Sandbox, Docker Hyper-V Containers, WSL 2, and similar features.

You can find more documentation on Hyper-V on Windows Server or Hyper-V on Windows 10 on Microsoft Docs.

List all containers and Hyper-V VMs

With the hcsdiag list command, you can create a list of containers and Hyper-V virtual machines running on the host. Including Windows Sandbox, Windows Subsystem for Linux 2, and Application Guard.

hcsdiag.exe list

hcsdiag.exe list

Connect Console to Hyper-V containers and Windows Sandbox

You can also directly connect to the console of containers or the Windows Sandbox. Remember that it only works for Hyper-V containers where the guest is not protected from the host. Not for containers like Hyper-V VMs, where the guest is also protected from the host. If you need to remote into want console access or run commands against a Hyper-V VM from the host, check out PowerShell Direct for Windows VMs and hvc.exe for Linux VMs.

hcsdiag console connect

hcsdiag console connect

Here is an example where I am connected to a Windows Sandbox container using hcsdiag.exe.

hcsdiag Windows Sandbox

hcsdiag Windows Sandbox

But that also works with Dockers container (Hyper-V containers) running Windows and Linux.

hcsdiag Linux Container

hcsdiag Linux Container

HCSDiag console provides you with an interactive connection to interact with the container.

Additional HCSDiag.exe features and commands

The HCSDiag.exe also provides you with a couple of additional commands you can use. For example, the read command to read a file from the container and output it to the host or as a file to the host.

hcsdiag read

hcsdiag read

You can use the “share” command to share a host folder into the container or use “vhd” to mount a virtual disk file (VHD) file to a container. The hcsdiag kill command terminates a running container.

Conclusion

HCSDiag.exe – Hyper-V Host Compute Service Diagnostics Tool is excellent if you need to troubleshoot these Hyper-V containers, virtual machines (VMs), Windows Sandbox, Windows Defender Application Guard, Windows Subsystem for Linux 2 and more. If you have any questions, feel free to leave a comment.



Create Azure Dedicated Host

Azure Dedicated Host for your Azure VMs

Last week Ziv Rafalovich, Principal Program Manager in the Azure Compute team, announced the Azure Dedicated Host Public Preview. Azure Dedicated Host is a new Azure service which enables customers to run Windows and Linux virtual machines on single dedicated physical servers. Usually, the Azure host is used by multiple tenants, and the virtual machines are isolated using a multi-tenant hypervisor, with Azure Dedicated Host, the physical server only runs workloads from one tenant/customer. This gives customers the visibility and control on what physical hardware their virtual machines are running, and it allows to address corporate compliance and regulatory requirements.

Azure Dedicated Host Preview provides physical servers that host one or more Azure virtual machines. Your server is dedicated to your organization and workloads—capacity isn’t shared with other customers. This host-level isolation helps address compliance requirements. As you provision the host, you gain visibility into (and control over) the server infrastructure, and you determine the host’s maintenance policies.

You can find more information on Azure.com.

Azure Dedicated Host scenarios

The Azure Dedicated Host offers a couple of benefits and enables some new scenarios.

  • Host-level isolations for compliance requirements
  • Visibility and control over the server infrastructure to manage host maintenance policies, load on the server, fault domain count.
  • You get control over the full performance and capacity from a single Azure host which is not shared with other customers.
  • You get the advantage of unlimited virtualization for Windows Server and SQL Server with Azure Dedicated Hosts using the Azure Hybrid Benefit.

If you need these scenarios, then the Azure Dedicated host is an excellent option for you. However, if you don’t need them, you are more flexible with the shared Azure virtual machine experience.

Licensing and Pricing

Dedicated Hosts are charged at the host level and not on the number of Azure VMs you run on the host. However, software licenses are billed separately from compute resources at a VM level based on usage. There are no upfront costs or termination fees. Currently, the Azure Dedicated Host is a pay-as-you-go service, and you only pay for what you need.

You will have different dedicated host types and VM series/families available. During the preview period, you will be able to choose between Dsv3, Esv3, and Fsv2 VM series.

Dedicated Host Typ 1

Dedicated Host Type 1 is based on the 2.3 GHz Intel Xeon® E5-2673 v4 (Broadwell) processor and can achieve up to 3.5 gigahertz (GHz). Type 1 host has 64 available vCPUs.

    • Dsv3 Series
    • Esv3 Series

Dedicated Host Type 2

Dedicated Host Type 2 is based on the Intel Xeon® Platinum 8168 (Skylake) processor, which can achieve maximum single-core clock speeds of 3.7 GHz and sustained all core clock speeds as high as 3.4GHz with the Intel Turbo Boost Technology 2.0. Type 2 host has 72 available vCPUs.

    • Fsv2 Series

Dedicated Host configuration table

This is the Dedicated Host configuration table during the Public Preview. This might change later, and you can find the current pricing information on Azure.com.

Azure Dedicated Host configuration table

Azure Dedicated Host configuration table

Additional cost reduction

You can use your on-premises Windows Server and SQL Server licenses with Software Assurance benefits, or subscriptions with equivalent rights, when you migrate your workloads to Dedicated Host (Azure Hybrid Benefit).  Different the before is that with the dedicated host you get unlimited virtualization rights for Windows Server and SQL Server. For more information on the updated Microsoft licensing terms for dedicated hosted cloud services, check out this blog post. With this running Windows Server 2019 in Azure becomes even more attractive.

We are also expanding Azure Hybrid Benefit so you can take advantage of unlimited virtualization for Windows Server and SQL Server with Azure Dedicated Hosts. Customers with Windows Server Datacenter licenses and Software Assurance can use unlimited virtualization rights in Azure Dedicated Hosts. In other words, you can deploy as many Windows Server virtual machines as you like on the host, subject only to the physical capacity of the underlying server. Similarly, customers with SQL Server Enterprise Edition licenses and Software Assurance can use unlimited virtualization rights for SQL Server on their Azure Dedicated Hosts.

You’ll also get free extended security updates for Windows Server and SQL Server 2008 and 2008 R2.

Azure Reserved VM Instances are not available for purchase during the preview on Azure Dedicated Host.

Deploy VMs to an Azure Dedicated Hosts

To deploy a new Azure Dedicated Host, we first need to create a host group. After that, we can add hosts to this group, which will be used for our Azure virtual machines. In this blog post, I am going to show you how you can deploy a new host and after that, how you deploy Azure VMs on that host using the Azure portal. If you want to know more and if you want to see how you do this using Azure PowerShell, an Azure Resource Manager (ARM) template or the Azure CLI, check the Microsoft Docs.

Create a host group

Azure Host Groups

Azure Host Groups

You can find a new Azure resource called Host Group. Create a host group and configure the host group with specific settings like availability zones and fault domain count.

"<yoastmark

Deploy an Azure Dedicated Host

Azure Dedicated Hosts

Azure Dedicated Hosts

After you have created your host group, you can start creating new hosts and add them to your host group.

  • Select the location (region) of the host
  • Select the dedicated host VM family and hardware generation. You will only be able to provision VMs on this host in the same VM family. During the preview, we will support the following host SKU values: DSv3_Type1 and ESv3_Type1.
  • Configure the fault domain for the host.
  • Enable or disable of automatically replacing the host on a failure.
  • Configure cost savings like the Azure Hybrid Benefit.
Create Azure Dedicated Host

Create Azure Dedicated Host

Your host will be deployed in a couple of minutes. Important, your Azure subscription will need to have enough resources (CPU/Cores) enabled. Some subscriptions are limited to a specific amount of cores you can deploy in your subscription, in that case, you will need to open a support ticket, to raise the number of cores available in your subscription.

Create a VM

Now you can create a virtual machine on the Azure Dedicated Host. There area few things to consider about that VM. First, make sure the VM is created in the region you have created the host. Secondly, choose a virtual machine size of the VM family you had configured when you created the host.

During the creation process, you will find the section Host in the Advanced tab. Here you can select your host group and your host where the VM will be deployed on.

For more information, check out the Microsoft Docs.

Conclusion

The Azure Dedicated Host service enables new scenarios and addresses, especially customers with host-level isolations for compliance requirements. It makes the Azure IaaS platform even more exciting, and together with Azure Migrate, you can quickly move your virtual machines to Azure. If you have any questions, feel free to leave a comment.



Hyper-V VM Configuration Version

Hyper-V VM configuration version supported features

A couple of months ago, I wrote an article about the new Microsoft Hyper-V UEFI in Windows Server 2019 and Windows 10 virtual machines. With that version Microsoft also released a new Hyper-V VM configuration version 9.0. This is not unusual, the Hyper-V teams usually bumps up the version number from release to release, since new Hyper-V features are introduced. In the comments, the question came up, what is new in this version of the Hyper-V VM configuration, Since the version was still a preview release of Windows Server and Windows 10, Microsoft didn’t share the full list of features per configuration version. However, now the documentation is ready and you can find the documentation here.

Supported features

The following table shows the minimum virtual machine configuration version required to use some Hyper-V features.

Windows ServerWindows 10VersionFeature
Windows Server 2016 Technical Preview 3Windows 10 15076.2Hot Add/Remove Memory
Windows Server 2016 Technical Preview 3Windows 10 15076.2Secure Boot for Linux VMs
Windows Server 2016 Technical Preview 3Windows 10 15076.2Production Checkpoints
Windows Server 2016 Technical Preview 3Windows 10 15076.2PowerShell Direct
Windows Server 2016 Technical Preview 3Windows 10 15076.2Virtual Machine Grouping
Windows Server 2016 Technical Preview 4 Windows 10 15117.0Virtual Trusted Platform Module (vTPM)
Windows Server 2016 Technical Preview 57.1Virtual machine multi queues (VMMQ)
Windows Server 2016Windows 10 Anniversary Update8.0XSAVE support
Windows Server 2016Windows 10 Anniversary Update8.0Key storage drive
Windows Server 2016Windows 10 Anniversary Update8.0Guest virtualization-based security support (VBS)
Windows Server 2016Windows 10 Anniversary Update8.0Nested virtualization
Windows Server 2016Windows 10 Anniversary Update8.0Virtual processor count
Windows Server 2016Windows 10 Anniversary Update8.0Large memory VMs
Windows Server 1803Windows 10 April 2018 Update8.3Increase the default maximum number for virtual devices to 64 per device (e.g. networking and assigned devices)
Windows Server 2019/1809Windows 10 October 2018 Update9.0Allow additional processor features for Perfmon
Windows Server 2019/1809Windows 10 October 2018 Update9.0Automatically expose simultaneous multithreading configuration for VMs running on hosts using the Core Scheduler
Windows Server 2019/1809Windows 10 October 2018 Update9.0Hibernation support

Source: Microsoft Docs (Thanks to Rene Moergeli for the link)

How to list the supported VM configuration versions

You can list all supported VM configuration versions on your Hyper-V host using the Get-VMHostSupportedVersion cmdlet.

 
Get-VMHostSupportedVersion

Get-VM Hyper-V VM Configuration Version

If you want to see the version of a Hyper-V virtual machine, you can use Hyper-V Manager or the following PowerShell command:

 
Get-VM

Full list of Hyper-V VM versions

Here you have a full list of VM configuration versions of Hyper-V VMs together with the operating system.

Windows ClientWindows ServerVersion
Windows Server 20081.0
Windows Server 2008 SP12.0
Windows Server 2008 R23.0
Windows 8Windows Server 20124.0
Windows 8.1Windows Server 2012 R25.0
Windows 10 1507Windows Server 2016 Technical Preview 36.2
Windows 10 1511Windows Server 2016 Technical Preview 47.0
Windows Server 2016 Technical Preview 57.1
Windows 10 Anniversary UpdateWindows Server 20168.0
Windows 10 Creators Update8.1
Windows 10 Fall Creators UpdateWindows Server 17098.2
Windows 10 April 2018 UpdateWindows Server 18038.3
Windows 10 October 2018 UpdateWindows Server 2019 / 18099.0
Windows 10 April 2019 UpdateWindows Server 19039.1
PrereleasePrerelease254.0
ExperimentalExperimental255.0

How to upgrade Hyper-V VM configuration version

Hyper-V vNext Update VM Configuration Version

Upgrading the Hyper-V VM version is pretty straight forward. If the VM is running on a host supporting a newer version of Hyper-V VMs, you can right click the virtual machine in the Hyper-V Manager and click on upgrade or you can run the Update-VMVersion PowerShell cmdlet.

 
Update-VMVersion

I hope this blog was help full for understanding Hyper-V VM versions, let me know if you have any questions in the comments!



Cannot remove Hyper-V Host from SCVMM

System Center Logo

Today I run in to the problem where I could not remove a Hyper-V Hosts from System Center Virtual Machine Manager. The Hyper-V host was reinstalled before he was removed from SCVMM and the host was showing has HOSTNAME (pending) in the SCVMM Management Console. If you did a right click to remove the host, the Remove option was greyed out.

But don’t worry Windows PowerShell came to the rescue, with the following command you can remove the Hyper-V host from Virtual Machine Manager.

 
Get-SCVMHost &lt;HOSTNAME&gt; | Remove-SCVMHost -force


SCVMM 2012: Add Logical Network to all Hyper-V Hosts in HostGroup via PowerShell

System Center Logo

To use the Logical Networks in System Center Virtual Machine Manager 2012 on a specific Hyper-V Host or Hyper-V Cluster you have to add the Logical Network to the network interface which the logical network is available. In the GUI you can do this in the properties of the Hyper-V host under Hardware.

SCVMM Hyper-V Host Properties Hardware

if you have a lot of Hyper-V hosts this can take some time. This Windows PowerShell script will help you. It will add the logical network on each Hyper-V host. It chooses the network adapter based on the network adapter name which is given on the Hyper-V host.

 
Import-Module virtualmachinemanager
$LogicalNetworkName = "LogicalNetwork"
$vmHostGroup = Get-VMHostGroup "HostGroupName"
$HostNetworkAdapterName = "Network Adapter Name"
$vmHosts = $vmHostGroup.AllChildHosts
 
foreach ($vmHost in $vmHosts) {
 
$guid = [guid]::NewGuid()
$logicalNetwork = Get-SCLogicalNetwork -Name $LogicalNetworkName
$vmHostNetworkAdapter = Get-SCVMHostNetworkAdapter -VMHost $vmHost | where-object {$_.ConnectionName -eq $HostNetworkAdapterName }
 
Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $vmHostNetworkAdapter -AddOrSetLogicalNetwork $logicalNetwork -JobGroup $guid
Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $vmHostNetworkAdapter -Description "" -JobGroup $guid -VLanMode "Trunk" -AvailableForPlacement $true -UsedForManagement $false
 
Set-SCVMHost -VMHost $vmHost -JobGroup $guid -RunAsynchronously
 
}

With the release of Service Pack 1 for System Center 2012 Virtual Machine Manager this is gone if you use the Logical Switch.



Hyper-V vs. VMware vSphere – Host Deployment

Windows Server 2012 RC Logo

VMware vSphere Enterprise Plus offers  a solution for centralized deployment of VMware Hypervisor hosts on physical hardware.

How does the deployment of Microsoft Hyper-V Server work? Microsoft Hyper-V can be deployed as Windows Server role or as Microsoft Hyper-V Server. Both setups are based on the normal Windows setups and you can use the same deployment processes.

  • DVD
  • USB
  • Windows Deployment Services (WDS)
  • Microsoft Deployment Toolkit (MDT)
  • System Center Configurations Manager

or my favorite deployment method: Bare-Metal Deployment with System Center Virtual Machine Manager. Blogger and Microsoft Consultant Michel Lüscher wrote a great blog post about how you can use the bare-metal deployment feature in SCVMM.