Tag: Windows Server

How to Manage Hyper-V VM Checkpoints with PowerShell

How to Manage Hyper-V VM Checkpoints with PowerShell

In this blog post we are going to have a look at how you can create, manage, apply, and remove VM Checkpoints in Hyper-V using PowerShell. Hyper-V virtual machine (VM) checkpoints are one of the great benefits of virtualization. Before Windows Server 2012 R2, they were known as virtual machine snapshots. VM Checkpoints in Hyper-V allow you to save the system state of a VM to a specific time and then revert back to that state if you need to. This is great if you are testing software and configuration changes, or if you have a demo environment, which you want to reset.

Hyper-V VM Checkpoint Types

Before we got on how you can manage Hyper-V VM Checkpoints with PowerShell, let me first explain the two different types. Since Windows Server 2016 and Windows 10, Hyper-V includes two types of checkpoints, Standard Checkpoints, and Production Checkpoints.

  • Standard Checkpoints: takes a snapshot of the virtual machine and virtual machine memory state at the time the checkpoint is initiated. A snapshot is not a full backup and can cause data consistency issues with systems that replicate data between different nodes such as Active Directory. Hyper-V only offered standard checkpoints (formerly called snapshots) prior to Windows 10.
  • Production Checkpoints: uses Volume Shadow Copy Service or File System Freeze on a Linux virtual machine to create a data-consistent backup of the virtual machine. No snapshot of the virtual machine memory state is taken.

You can set up these settings in Hyper-V Manager or in PowerShell.

Hyper-V VM Checkpoint Types

Hyper-V VM Checkpoint Types

If you are using PowerShell to configure Checkpoints for virtual machines these commands may help you.

Configure and set VM for Standard Checkpoints

Set-VM -Name "Windows10" -CheckpointType Standard

Set VM to Production Checkpoints, if the production checkpoint fails a Standard Checkpoint is created

 Set-VM -Name "Windows10" -CheckpointType Production

Set VM to only use Production Checkpoints

 Set-VM -Name "Windows10" -CheckpointType ProductionOnly

Disable VM Checkpoints for the Hyper-V virtual machine

 Set-VM -Name "Windows10" -CheckpointType Disabled

Managing Hyper-V VM Checkpoints using PowerShell

Create VM Checkpoints

You can create a new VM Checkpoint with PowerShell, you can round the following command:

Checkpoint-VM -Name "Windows10"

You can find more on the cmdlet on Microsoft Docs.

You can list the VM Checkpoints of a Hyper-V VM:

Get-VMCheckpoint -VMName "Windows10"
How to Manage Hyper-V VM Checkpoints with PowerShell

How to Manage Hyper-V VM Checkpoints with PowerShell

Applying Hyper-V VM checkpoints using PowerShell

If you want to revert your virtual machine state to a previous point-in-time, you can apply an existing checkpoint, using the following PowerShell command.

Restore-VMCheckpoint -Name "checkpoint name" -VMName "Windows10" -Confirm:$false

You can find more information about the cmdlet here.

Renaming checkpoints

To rename a checkpoint you can use the following command

Rename-VMCheckpoint -VMName "Windows10" -Name "Checkpointname" -NewName "MyNewCheckpointName"

Deleting checkpoints

You can also delete or remove a Hyper-V VM checkpoint with the following PowerShell command. This will merge the .avhdx files in the background.

Remove-VMCheckpoint -VMName "Windows10" -Name "Checkpointname"

Conclusion

I hope this blog post gives you a great overview on how you can manage, apply, restore, and remove Hyper-V VM Checkpoints using PowerShell. You can learn more about Hyper-V virtual machine checkpoints on Microsoft Docs. If you have any questions, feel free to leave a comment.



Intel NUC Windows Server LAB

Install Intel NUC Windows Server 2019 Network Adapter Driver

As you know, I am using an Intel NUC as my Windows Server lab machine, where I run Windows Server 2019 and Hyper-V on. Many people asked me about how you can install the Intel NUC Windows Server 2019 Network Adapter driver because there are no Windows Server 2019 drivers for it. My blog reader, Michael Williams, shared how you can install the Windows Server 2019 Network adapter drivers on the Intel NUC 8th generation.

Here are the simple steps you can follow to install the Intel NUC Windows Server 2019 Network Adapter Driver:

  1. Download the latest PROWinx64.exe for Windows Server 2019 from Intel including drivers for the Intel® Ethernet Connection I219-V
  2. To manually install the network drivers, extract PROWinx64.exe to a temporary folder – in this example to the C:\Drivers\Intel\ folder. Extracting the .exe file manually requires an extraction utility like WinRAR or others. You can also run the .exe and it will self-extract files to the %userprofile%\AppData\Local\Temp\RarSFX0 directory. This directory is temporary and will be deleted when the .exe terminates.
  3. The driver for the Intel I219-V network adapter can be found in the C:\Drivers\Intel\PRO1000\Winx64\NDIS68.
    Extracted Network Drivers for Windows Server 2019 - Intel NUC PROWinx64

    Extracted Network Drivers for Windows Server 2019 – Intel NUC PROWinx64

  4. Open Device Manager right click on Ethernet Controller and select Update Driver.
    Device Manager Update Driver Ethernet Controller - Intel NUC Windows Server 2019 Driver

    Device Manager Update Driver Ethernet Controller – Intel NUC Windows Server 2019 Driver

  5. Select “Browe on my computer for driver software”, and select “Let me pick from a list of available drivers on my computer”, now you can select Network Adapter.
    Update Driver

    Update Driver

  6. Click on “Have Disk…” enter the following path “C:\Drivers\Intel\PRO1000\Winx64\NDIS68.”

    Driver Location

    Driver Location

  7. Now select Intel Ethernet Connection I219-LM (The I219-V version is not shown)
    Select the Intel Ethernet Connection I219-LM

    Select the Intel Ethernet Connection I219-LM

  8. And you are done.

Huge thank you again to Michael Williams for sharing that with us. I hope this short blog post provides you a step by step guide on how you can install Windows Server 2019 Network adapter drivers on the Intel NUC. If you have any questions, feel free to leave a comment.



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.



Azure Arc Enabled Servers Extension Management

Azure Arc Enabled Servers Extension Management

Azure Arc for Server just got a couple of new features. In this blog post, we are going to have a look at the new feature on Azure Arc enabled servers called extension management. This new Azure Arc enabled servers features allows you not only to deploy extensions like the Custom Script Extension, or the Microsoft Monitoring Agent but also enable features like Azure Update Management, Inventory, Change Tracking, and more for your servers running in a hybrid environment.

Introducing Azure Arc
For customers who want to simplify complex and distributed environments across on-premises, edge and multicloud, Azure Arc enables deployment of Azure services anywhere and extends Azure management to any infrastructure.
Learn more about Azure Arc here.

Azure Arc enabled servers already could benefit from several Azure Resource Manager features like Tags, Policies, RBAC, and some Azure Management features like logs and Azure Policy. With the new update, you can start using more extensions.  With these extensions available, Azure Arc enabled servers also get features like Azure Update Management, Inventory, Change Tracking, and insights capabilities.

Azure Arc Azure Management Control Plane

Azure Arc Azure Management Control Plane

Azure Arc Enabled Servers Extension Management Video

You can also watch my summary video on YouTube.



Windows Server 2019 Inside Out Microsoft Press Book

Windows Server 2019 Inside Out Microsoft Press Book Available

My friend and colleague Orin Thomas just shared some fantastic news. His new book Windows Server 2019 Inside Out for Microsoft Press is now available. I was able to provide some early feedback during the writing process and I can tell you this book is a must-have if you are working with Windows Server 2019.

Dive into Windows Server 2019—and really put your Windows Serverexpertise to work. Focusing on Windows Server 2019’s most powerful and innovative features, this supremely organized reference packs hundreds of timesaving solutions, tips, and workarounds—all you need to plan, implement, or manage Windows Server in enterprise, data center, cloud, and hybrid environments. Fully reflecting new innovations for security, hybrid cloud environments, and Hyper-Converged Infrastructure (HCI), it covers everything from cluster sets to Windows Subsystem for Linux.

You can get the book on Amazon and you will learn how to:

  • Optimize the full Windows Server 2019 lifecycle, from planning and configuration through rollout and administration
  • Leverage new configuration options including App Compatibility Features on Demand (FOD) or Desktop Experience
  • Ensure fast, reliable upgrades and migrations
  • Manage Windows servers, clients, and services through Windows Admin Center
  • Seamlessly deliver and administer core DNS, DHCP, file, print, storage, and Internet services
  • Use the Storage Migration Service to simplify storage moves and configuration at the destination
  • Seamlessly integrate Azure IaaS and hybrid services with Windows Server 2019
  • Improve agility with advanced container technologies, including container networking and integration into Kubernetes orchestration clusters
  • Deliver Active Directory identity, certificate, federation, and rights management services
  • Protect servers, clients, VMs, assets, and users with advanced Windows Server 2019 security features, from Just Enough Administration to shielded VMs and guarded virtualization fabrics
  • Monitor performance, manage event logs, configure advanced auditing, and perform backup/recovery Windows Server 2019
Microsoft Inside Out Windows Server 2019 Book

Microsoft Inside Out Windows Server 2019 Book

If you got the new Windows Server 2019 Inside Out Microsoft Press book, let me know what you think!



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.



Windows Server webinar miniseries - Month of Cloud Essentials Speakers

Windows Server webinar miniseries – Month of Cloud Essentials

I want to let you know that in June I will be speaking in the Windows Server webinar miniseries focusing on how you can leverage the power of Azure together with Windows Server. Jeff Woolsey, Pierre Roman, Orin Thomas and I will be speaking about different scenarios using Windows Server in a Hybrid environment.

Join this four-part Windows Server webinar miniseries to learn tips and best practices for bringing the efficiencies and cost savings of Azure to your Windows Server workloads. Each 30-minute session includes demos and a live Q&A with Microsoft technical experts.

The Windows Server webinar miniseries – Month of Cloud Essentials sessions will focus on:

Intro to Windows Server Apps in the Cloud
June 4, 9:00 AM–9:30 AM Pacific Time by Jeff Woolsey 📅
Get an overview and explore resources to help you start running your Windows Server workloads on Azure.

How to Manage Windows Server Roles with Azure Services
June 11, 9:00 AM–9:30 AM Pacific Time by Orin Thomas 📅
Learn best practices to help improve security and scalability for apps by easily migrating Windows Server roles such as Active Directory, Windows File Server, and DNS to Azure.

Create Highly Available Apps with Azure VMs
June 18, 9:00 AM–9:30 AM Pacific Time by Pierre Roman 📅
Find out how to run business-critical Windows Server applications on Azure with consistent security, identity, and management features.

Modernize Windows Server Apps on Azure
June 25, 9:00 AM–9:30 AM Pacific Time by Thomas Maurer 📅
Explore hybrid cloud approaches for connecting your on-premises and multicloud environments to Azure with strategies that include containers.

I am looking forward to seeing you in the Windows Server webinar miniseries – Month of Cloud Essentials. If you miss any of the sessions, watch them on demand. You can register here.

If you have any questions, feel free to leave a comment.