Multi Server Management for Hyper-V (Part 2)

If you would like to read the other parts in this article series please go to:

Introduction

So far in this series, I have shown you a variety of techniques for collectively managing virtual machines. In addition to the techniques that I have already shown you, Windows Server 2012 and Hyper-V provide some wonderful PowerShell based multi-server management capabilities. Before I get to that though, I want to show you one more technique for collectively managing Hyper-V host servers.

Server Grouping

As you are no doubt aware, Windows Server 2012 contains a new version of Server Manager. Although not completely intuitive, one of the really great features found in this new version is the ability to collectively manage Windows servers.

The server grouping feature is not actually a Hyper-V feature, but rather a Windows Server 2012 feature. That being the case, you cannot use it to perform virtual machine management in the sense of modifying the virtual machine resources or live migrating a virtual machine to an alternate host. However, this feature is useful nonetheless.

Server grouping allows you to create groups of similar servers – physical or virtual. This grouping means that you can collectively manage servers that are performing similar tasks. For instance, you might consider creating a group for all of your Hyper-V hosts. Likewise, you could create a group for virtual machines that need to be collectively managed. For instance, you might create a group for your virtualized domain controllers.

The process of creating a server group is actually really simple. To do so, open the Server Manager and then choose the Create Server Group command. When the Create Server Group dialog box appears, enter a name for the new group, as shown in Figure A.

Image
Figure A: 
Enter a name for the new server group.

The next step is to add servers to the server group that you are creating. You will notice in the figure that right now the Server Pool tab is selected. This means that the dialog box will list all of the servers that currently exist within the server pool. To add a server to the new server group, simply select the server and then click the arrow icon.

In most cases the group that you are creating probably will act as a sub set of the servers that are in the server pool. However, you can add servers that do not currently exist within the pool. As you can see in the figure above, the dialog box contains three other tabs – Active Directory, DNS, and Import. You can use these tabs to add computers that are Active Directory members, add servers by fully qualified domain name or IP address, or to import a file containing a list of servers. When you have made your selections, click OK.

If you look at Figure B, you can see that I have created two server groups – Lab Servers and Production Servers. The groups are listed in the column to the left, with the Production Servers group currently selected.

Image
Figure B: 
You can create a series of server groups.

In case you are wondering, the Production Servers group that is shown in this figure contains Hyper-V hosts that are running production workloads. I could have just as easily created a group for production virtual machines. The only real requirement for doing so is that Server Manager needs to be able to see those virtual machines, which basically means that you won’t be able to add virtual machines that reside on an isolated virtual network segment that is inaccessible to the host operating system or to the physical network.

Creating a server group does more than just group similar servers together. You can collectively manage the servers within the group. For example, if you take a look at Figure C, you can see that I have selected both of the servers in the Production Servers group. If you look at the Services pane near the bottom of the screen, you will notice that it contains listings from both of the selected servers.

Image
Figure C: 
The console can display aggregate information from multiple servers.

PowerShell Management

If you need true Hyper-V level management for multiple virtual machines or for multiple Hyper-V hosts, then your best option is often to use PowerShell. Windows Server 2012 is specifically designed to allow multi server Hyper-V management through PowerShell. In fact, you can use PowerShell to accomplish many of the same management tasks that you could perform if you had System Center 2012 Virtual Machine Manager (which I discussed in the previous article).

There are a few different ways in which PowerShell lets you run commands against multiple targets. One method that you can use is to establish a session with a remote Hyper-V host. This isn’t technically a multi-server management technique, because your actions are performed against a single host, but it does allow you to execute a command on a remote Hyper-V server.

To show you how this technique works, let’s assume that you wanted to run the Get-VM command against a remote server named Lab1. In case you aren’t familiar with the Get-VM command, it is one of the simplest PowerShell commands for Hyper-V. This command returns a list of the virtual machines that exist on the host server. The commands that you would use to run the Get-VM cmdlet on a host named Lab1 are:

Enter-PSSession Lab1
Get-VM
Exit-PSSession

The first line in this block of code establishes a session with the remote server. When this happens, you will actually see the PowerShell prompt change to reflect the fact that you are now connected to a remote server instead of the local server.

The second command is the Get-VM command. Keep in mind that I am only using Get-VM as an example. You could actually use any PowerShell cmdlet here.

The last line of the block of code shown above is Exit-PSSession. This command terminates your session with the remote Hyper-V hosts. The most important thing to know about this command is that until you enter the Exit-PSSession command you will remain connected to the remote host. In the sample code block listed above, we established a connection to a remote host, executed a single PowerShell cmdlet, and then terminated the session. While this is perfectly valid behavior, you aren’t limited to executing only a single PowerShell cmdlet within the remote session. You are free to execute as many cmdlets as you want (or even to run PowerShell scripts) until the session is terminated.

As I mentioned earlier, this is only one example of a way that you can use PowerShell for multi-server management. There are several other techniques that you can use. One technique isn’t necessarily better than another. It’s just that depending on what you are trying to accomplish, one technique might be better suited to a particular task than another technique would be.

Conclusion

In this article, I have demonstrated a couple more techniques for multi-server management in a Hyper-V environment. In Part 3 I plan to conclude the series by showing you some PowerShell commands that will allow you to perform administrative actions in bulk against multiple physical or virtual servers.

If you would like to read the other parts in this article series please go to:

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top