Book Image

Windows Server 2016 Hyper-V Cookbook - Second Edition

By : Charbel Nemnom, Patrick Lownds, Leandro Carvalho
Book Image

Windows Server 2016 Hyper-V Cookbook - Second Edition

By: Charbel Nemnom, Patrick Lownds, Leandro Carvalho

Overview of this book

Hyper-V 2016 is full of new features and updates. The second of our best-selling Hyper-V books, the Windows Server 2016 Hyper-V Cookbook has it all covered. Brimming with expert solutions and techniques, you?ll have everything you need to master virtualization and Hyper-V Manager. This Hyper-V book is designed to help advanced-level administrators benefit fully from the new Windows Server. With over 80 hands-on recipes, the Hyper-V Cookbook gives you tips, tricks and best practices to deploy, maintain and upgrade your virtual machines.
Table of Contents (19 chapters)
Windows Server 2016 Hyper-V Cookbook - Second Edition
Credits
About the Authors
Acknowledgments
www.PacktPub.com
Customer Feedback
Preface
Index

Managing Nano Server using Server Management Tools – SMT


The Server Management Tools (SMT) is a new service hosted in Microsoft Azure, which is still in preview at the time of this writing.

The Server Management Tools includes the following features:

  • View and change system configuration

  • View performance across various resources and manage processes and services

  • Manage devices attached to the server

  • View event logs

  • View the list of installed roles and features

  • Use a PowerShell console to manage and automate

Using the Azure portal from anywhere, on any browser, Server management tools is a free cloud service that requires Azure subscription which enables you to remotely manage machines running Windows Server 2016 including Nano Server, Windows Server 2012 R2, and Windows Server 2012 with and without Hyper-V.

Getting ready

To create a new connection for the first time, you will need to create a new gateway by configuring an existing server to connect to Azure as the gateway to your environment, as shown in the following diagram. The gateway allows connections to be routed to other servers and you can then use web-based versions of familiar tools, such as PowerShell, Task Manager, Event Viewer, Firewall, File Explorer, Network Settings, Windows Update, Registry Editor, and so on, to manage servers in that network:

The server management gateway can be a Windows Server 2012 R2 Server running the Windows Management Framework 5.0—WMF 5.0 (https://www.microsoft.com/en-us/download/details.aspx?id=50395) or Windows Server 2016 with no additional preparation. You also need a Microsoft Azure subscription and an account.

The gateway will handle the connection to Azure and the Server Management Gateway that is deployed on-premises needs connection to the Internet. The managed Nano servers do not need a direct connection to the Internet; the gateway will connect to the managed Nano servers. With that, the gateway needs a connection to Nano server(s) that will be managed from Azure.

One of my favorite remote management features in SMT is the web-based PowerShell console, as shown in the following screenshot:

How to do it...

In order to manage Nano server installation using SMT carry out the following steps:

  1. Prepare a new Windows Server 2016 virtual machine on the premises in which you would connect to the Internet, it should have the latest updates installed.

  2. Create a Nano machine that you want to be able to manage via Server management tools.

  3. To begin your deployment, log in to your Azure portal account and search for Server management tools in Marketplace or navigate to Marketplace | Management | More | Server management tools.

  4. Select the Server management tools, read the description, review the terms of this release, and click on Create.

  5. In the computer name field, make sure you enter the Nano Server machine name, which you have deployed on-premises in Step 2, as shown in the following screenshot.

  6. After the connection is created, you can see the connection as shown in the following screenshot; however, you will get the information that the gateway is not ready. As the next step, you will configure the gateway on the prepared server:

  7. Under the Server Management Tools Gateway, you can find a setup for the gateway that will generate a custom install package for your gateway. As shown in the following screenshot, you can copy this link, download this package, which is around 4 MB in size, and install it on your gateway server:

  8. Unzip the gateway package from the machine that you want to designate as the gateway; the package contains two files, profile.json and GatewayService.MSI. Run the GatewayService, as shown in the following screenshot and walk through the steps in the MSI setup file.

    Note

    Note that you can also install the Gateway on a Windows Server Core machine using the following MSI parameters through the command line:

    GatewayService.msi /qn GATEWAYPROFILEJSON=c:\temp\gateway\profile.json ACCEPTEULA=true ACCEPTPRIVACYPOLICY=true
    

    You need to replace the preceding path with the appropriate absolute path to the profile.json.

  9. After you have installed the Server Management Gateway package on your gateway server you can see the connection in the Azure portal.

  10. Once the gateway installation is completed, return to the Microsoft Azure portal and reopen your SMT connection, click on the Manage as command and enter administrative credentials of your Nano Server, as shown in the following screenshot:

As shown in the following screenshot, you should be able to manage your Nano machine if the Microsoft Azure portal can reach it through the gateway:

Now you can start remote managing your Nano server. As mentioned earlier, the new management tool is really handy if you want to manage Server Core or Nano Server.

How it works...

The main management story in Nano Server is core PowerShell:

  • Windows Management Instrumentation (WMI)

  • Windows Remote Management (WinRS)

  • Emergency Management Services (EMS)

PowerShell relies on the .NET Framework, as you noticed Nano Server is a small and tiny OS and only has the Core Common Language Runtime (CLR). The Core CLR is a tiny subset of the .NET Framework, the PowerShell team went ahead and refactored PowerShell to run on Core CLR, which was a huge effort. The good news is that PowerShell users probably will not miss the most important features. It has full language compatibility and supports PowerShell remoting, so you can use the most popular remote command, such as (Invoke-Command, New-PSSession, Enter-PSSession, and so on).

Each Nano Server image contains, by default, Core CLR that takes up 45 MB of space, PowerShell itself takes about 8 MB of space, and there is 2 MB available for two built-in modules. Remoting is turned on by default, so a Nano server installation will always be ready to be remoted into and be managed remotely.

See also

Managing virtual machines with PowerShell Direct recipe in Chapter 4, Saving Time and Cost with Hyper-V Automation.