Monitor Hyper-V with the command line (Part 1): Install the monitoring library
One of the obvious shortcomings of Hyper-V is the ability to monitor virtual machines from Windows PowerShell. Although Microsoft intends to provide this capability on Windows Server 8, users can fully monitor virtual machines from the command line interface at this time. The article will guide you to do this
TipsMake.com - One of the obvious shortcomings of Hyper-V is the ability to monitor virtual machines from Windows PowerShell. Although Microsoft intends to provide this capability on Windows Server 8, users can fully monitor virtual machines from the command line interface at this time. The article will guide you to do that.
Get the Hyper-V monitoring library
Although Hyper-V does not provide local PowerShell monitoring features, there is a PowerShell monitoring library that can be downloaded from CodePlex. The current release is only designed to work with PowerShell version 2.0.
Prepare to install
Before installing the Hyper-V monitoring library, we will need to install Windows PowerShell. Hyper-V monitoring library is designed to work with a standalone Hyper-V server, Hyper-V works in Server Core or servers running Windows Server 2008/2008 R2.
PowerShell can be installed by opening the Server Manager-console, selecting Features and clicking the Add Features link . The Add Features installation window will ask what features users want to install. Select the Windows PowerShell feature integrated Scripting Enviroment then follow the instructions to complete the installation process.
Install hyper-V monitoring library
After downloading the Hyper-V monitoring library from the link above, we get a ZIP file containing:
- Install.cmd: Is the library installation file.
- PC_Console.REG: Update the registry for the server to be compatible with Hyper-V monitoring library.
- A Hyper-V directory: This directory contains data for creating libraries.
Right-click Install.cmd and select Run as Administrator from the context menu. Windows will open a command prompt and display a PowerShell Module for Hyper-V message to make sure that the .NET Framework and Windows PowerShell are all installed on the server. Press any key to continue. Then the user will receive a string of error messages as shown below.
These error messages are harmless. The reason we see them is because the installation file is designed to be used for Server Core. Press any key to update the registry for the server. After pressing, the file installs using the PS_Console.REG file to modify the server's registry.
Next, press any key to download PowerShell. When PowerShell loads, there will be an error message saying the Hyper-V module cannot be imported.
Although the above error is harmless, it means that the user will have to complete the installation process manually. Fortunately, the implementation process is relatively easy.
Import Hyper-V modules
Use the following PowerShell command to import the Hyper-V module:
Import-Module 'C: Program FilesModulesHypervHyperv.psd1'
Remember to run PowerShell under Administrator (Run as Administrator) before executing the new command to import the module.
To run PowerShell as an administrator, right-click the PowerShell icon and select Run as Administrator from the context menu.
When PowerShell opens, enter the Get-ExecutionPolicy command. Next, enter the Import-Module command above to import the Hyper-V module.
If you receive an error message when trying to import the Hyper-V module, the problem may be that Windows blocks the scripts from the Internet. Unblock the script by opening Windows Explorer and accessing the folder C: Program FilesModulesHyperv. Now, right-click on the first file in the folder and select Properties from the context menu. When the properties sheet appears, click Unblock then click OK . Repeat the process for each file in the directory.
Use Hyper-V monitoring library
After entering the Hyper-V module, there are many commands (cmdlets) that we can use. For example, if we enter Show-HyperVMenu, we will see a text monitoring interface for Hyper-V. This interface provides functionality similar to Hyper-V Manager.
Now, the Hyper-V monitoring library is installed and running. In the following article, we will learn some very useful commands from PowerShell.
You should read it
- Monitor Hyper-V with the command line (Part 2): Basic monitoring commands
- Monitor Hyper-V with the command line (Part 3): Check virtual machine status
- How to rename Hyper-V virtual machines using PowerShell and Hyper-V Manager
- Monitor Hyper-V with the command line (Part 4)
- How to export Hyper-V virtual machines in Windows 10
- How to import Hyper-V virtual machines in Windows 10
- How to check if your computer is running Windows 10 Hyper-V?
- Create virtual machines with Hyper-V on Windows 8 and Windows 10
- How to fix Hyper-V error 0x8009030E in Windows
- Create virtual machines in Hyper-V on Windows Server 2008
- Instructions for using Hyper-V on Windows 8 (Part 1)
- How to create and use Hyper-V checkpoints in Windows 10
Maybe you are interested
What is varicose veins? There is no cure? 15 miraculous uses of lemon you may not know Rounded eyes with 7 bizarre prohibitions can only exist in the Middle Ages What terrible thing will happen when not wearing protective gear in space? What happens inside the human body when it is about to drown? Concussion conclusions: In addition to 3 solid, liquid, water gas, there is a fourth state