Hyper v control. Automatic startup and shutdown of virtual machines on the Microsoft Hyper-V platform

Back in Windows 8, Hyper-V virtualization technology appeared, previously available only in Microsoft server operating systems. This solution looks better than the virtual one that came with Windows 7. windows machine Virtual PC. Today I will tell you how to create a virtual machine in Windows using Hyper-V, as well as configure the Internet, local network and file sharing in it.

In addition to Coreinfo, you can use Intel's proprietary utility (AMD has a similar one).

You can also check the virtualization technology support matrix on your processor manufacturer's website: Intel | AMD.

Enabling the Hyper-V Feature

Hyper-V is an operating system component that is initially disabled. Advanced users can enable it with a single PowerShell command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

If you prefer a graphical interface, press Win + R , type OptionalFeatures and press Enter .

In the window that opens, check the Hyper-V box.

One way or another, the component will become available after the system is rebooted. Of the installation problems in Windows 8 RP, a cyclic reboot due to the fault of the drivers has been noticed so far USB controller 3.0, which on some systems was solved by disabling USB 3.0 in the BIOS.

Create and configure a virtual machine

Press Win + R , type virtmgmt.msc and press Enter to open Hyper-V Manager. From the menu Actions select CreateVirtual machine.

The wizard for creating a virtual machine is extremely simple, however, I will note some points for those who like detailed instructions with pictures. I will skip the network setup step for now, as I will analyze this issue in more detail.

Standard location for virtual machines- folder ProgramData, but it can be changed.

If you already have virtual disk in VHD format, you can connect it. By the way, I did just that, using the disk created earlier for Virtual Box.

When you specify an existing VHD, the wizard skips the step that specifies the installation media.

However, you can also specify the path to the ISO later by opening the virtual machine settings in the main Hyper-V Manager window.

Starting a virtual machine and installing Windows on it

Here, too, everything is simple, but a little unusual for those who have not previously encountered Hyper-V.

In Hyper-V Manager:

  • to start the virtual machine, click "Start"
  • to interact with it, click "Connect" or double-click the thumbnail of the machine

When a machine is set to boot Windows ISO, you will see the familiar inscription Press any key to boot on the screen ... Then you can handle it yourself, but if you need step by step instructions by installation, they are on OSZone for Windows 7 and Windows 8.

If the operating system is physical machine newer than the one installed on the virtual one, it is recommended to update the integration components (thanks, Artem). To do this, connect in the Hyper-V manager to the virtual machine, press Ctrl + I and run setup.exe.

Setting up Internet access and local network

The instructions in this section are only necessary if you are not satisfied with the Default Switch that was introduced in Windows 10 1709, which cannot be deleted or renamed. At using Default Switch, if the host is connected to the VPN, the virtual machine also uses the VPN. This is one of the main differences from the external switch, the creation of which I will describe next.

On the menu Actions select Configuring Virtual Switches. A window will open in which you can create a switch of one of three types. To enable your virtual machine to access the Internet, create external switch.

Now you need to set the name of the switch and select network adapter if you have more than one. At home I use wireless network, so I chose wifi adapter.

It remains only to specify the created switch in the parameters network connection virtual machine.

Now in installed Windows you will have an internet connection and a local area network between the physical and virtual machines.

In the picture above you see:

  • on the left is the result of adding a virtual switch to Hyper-V on a physical machine, i.e. network bridge and virtual adapter
  • on the right - Internet access and connection to local network on a virtual machine

As you can see, setting up the Internet and local network is not so much complicated as it is unusual for users of Microsoft client operating systems.

Sharing files between physical and virtual machines

In the course of working with a virtual machine, it regularly becomes necessary to copy files to it from a physical one, or vice versa. I will describe several ways to solve this problem.

Shared network folders

This method works in all editions of Windows 10. Since we have a local network at our disposal, we can use shared folders to share files. In fact, the instructions below boil down to the basics of creating shared folders.

Access from virtual machine to physical

A picture is worth a thousand words, as the Americans say.

The figure shows the virtual machine explorer (VIRTUAL-PC) from where the physical machine (VADIK-PC) is accessed. As soon as you enter the account credentials, access to his profile will be at your disposal.

You may want to share a folder located on a physical machine outside of your profile. To do this, it is enough to use standard means sharing, but I will explain this process using the example of accessing an arbitrary folder of a virtual machine.

Access from a physical machine to a virtual one

Let's say there is a folder in the root of the virtual machine's disk shared. Click on it right click mouse and select General access individual people(or Specific Users in Windows 7).

You can now open a shared folder over the network in File Explorer, including typing in address bar view address \\computername\foldername.

Remote Desktop Connection of a Virtual Work Machine

In Hyper-V, files cannot be exchanged between a physical machine and a virtual machine by copy and paste. You can only paste the text copied on the physical machine with the keyboard shortcut Ctrl + V . However, once the virtual machine has started, you can connect to it via RDP instead of opening it from Hyper-V Manager. This method works in Pro editions and above.

Actions on the virtual machine

First you need to allow remote desktop connections on the virtual machine in the system properties. Press Win + R and run:

RUNDLL32.EXE shell32.dll,Control_RunDLL sysdm.cpl,5

Then allow the connection as shown in the picture.

It remains only to find out the IP address of the virtual machine with the command ipconfig

Actions on the physical machine

Press Win + R and type mstsc and expand login options.

In the window that opens:

  1. Enter the IP address of the virtual machine (required).
  2. Specify the username for which account will be logged in.
  3. Turn on remember credentials.
  4. Save your connection settings.

You can also set the Display tab to a resolution lower than what is used on the physical machine.

Now you can share files between physical and virtual machines with the familiar keyboard shortcuts Ctrl + C and Ctrl + V .

Finally, I would like to virtualize some of Denis Diaghilev's recommendations for working with Hyper-V.

Use RDP to connect to virtual machines.

This will not only allow you to exchange files between a physical and virtual machine by copying and pasting, but will also save system resources consumed by vmconnect when connecting to a virtual machine in Hyper-V Manager or from command line.

If you plan to regularly use RDP to connect to various virtual machines, pin the program to the taskbar. Then the list of machines will be stored in the jump list.

Be careful with pictures

With Hyper-V, you can take snapshots of a virtual machine using differential disk technology. However, the logic of how the images work is practically the opposite of what a person who has never stepped on a rake expects from her.

Alexander Kosivchenko (Virtualization MVP) described in detail, albeit somewhat chaotically, the principle of Hyper-V snapshots on Habré.

Use virtual machine import if needed

Import will be of more interest to IT professionals, but I happened to use this feature by accident. After creating the virtual machine, I renamed the drive letter where it was stored, after which the Hyper-V manager lost it.

Looking around in the snap, I saw the import option and instantly restored the machine.

And I didn’t even suspect that the actions I performed became possible only due to the appearance of a new feature in Hyper-V :)

Hyper-V vs. virtual box

While tinkering with Hyper-V, I unwittingly compared Microsoft's client operating system solution to Oracle's VirtualBox.

From the point of view of typical tasks of home users (testing the installation of the system, getting acquainted with it, checking the operation of applications), these solutions practically do not differ from each other. But VirtualBox can be used on home editions of Windows 10, while Hyper-V is not available on them.

VirtualBox does not have such stringent hardware requirements, and its graphics capabilities even wider because there is support hardware acceleration 3D (although I never used it).

Concerning GUI Well, it's purely a matter of taste. Probably, the hypervisor that came from the server operating systems looks more ascetic, but the parameters and settings of virtual machines are generally very similar.

The presence of Hyper-V in Windows will primarily please IT professionals who are accustomed to this technology. For home users, this is a good opportunity to take advantage of the system's built-in tools and expand their horizons by joining Microsoft server technologies.

Interview

I was introduced to virtual machines in 2004 when I started autoinstalling Windows. Since then, they have become an integral part of my daily work, including testing system settings, programs, and so on.

In comments tell us what virtualization solution you use and for what purpose!

I want to thank Denis Diaghilev for his help in preparing this material. One of the benefits of the MVP program is exposure to top Microsoft technology experts. This means that in private you can get competent advice on any issue;)

Denis also kindly offered his help in leading the discussion. So if you have any technical questions about this article, you can count on qualified answers.

I want to specifically emphasize that

I had the opportunity to install and configure a free hypervisor from Microsoft - Hyper-V Server 2012 R2. Previously, I had to work with Hyper-V, but as part of a full-fledged server, I did not install the free version. In general, I like Hyper-V, so I decided to look at its free version. What I saw did not meet my expectations a little, but first things first. This article is also suitable for installation and windows settings Server 2012 R2 core.

Installing Hyper-V Server 2012 R2

First of all, we download the latest version of the hypervisor from the Microsoft website. You must download the English version. Firstly, there were some bugs in Russian, although they could have been fixed already, but this is not the only thing. To automate and simplify the configuration of Hyper-V Server 2012 R2, we will use scripts written for English version, in Russian they will not work. I first installed the Russian version, spent some time, then spat and reinstalled the system.

The installation is quite banal and does not fundamentally differ from any other windows installation. The image is downloaded, the system is loaded from it and installed. At the end of the installation, we are greeted by a console with Hyper-V Server 2012 R2 settings:

I will immediately give a hint in case you close the Hyper-V Server Configuration console. You can start it again with the command sconfig. I had to spend a decent amount of time to figure out how to do this without restarting the server.

Configuring Hyper-V Server 2012 R2

Through the console, set the necessary settings:

1. Specify working group. I am considering setting up a standalone server that is not part of a domain network. In the domain settings will be different.
2. Specify the server name.
3. Create an additional user. You can work as an administrator, which is created by default, but it is better to create a separate user to manage. Later it will become clear why.
4. Turn on remote control.
5. Turn on automatic update.
6. Download and install updates.
7. We allow all clients to connect via rdp, with any version of the protocol.
8. Set network settings.
9. Set the time and date.

On this initial setup finished. While everything is clear and logical.

Using the command line in windows, in my opinion, is very inconvenient. The commands are long, non-obvious, setting up the hypervisor and creating virtual machines through the command line is incredibly long and tedious. In addition, copy-paste is often buggy, long commands have to be typed manually. I had to google to at least understand how I can upload the system image to the server in order to somehow start installing the virtual machine.

Preparing to remotely manage Hyper-V Server 2012 R2

So, in order to conveniently manage the free hypervisor Hyper-V Server 2012 R2, you need to follow a series of steps.

First of all, take a flash drive and write to it Total Commander and HVRemote. We paste it into the server and use the command line to create a folder on drive C: and copy our programs there. Now, through the command line, launch Total Commander:

Now we have at least a convenient file manager. Set up further. On the command line, disable the firewall with the following command:

netsh advfirewall set allprofiles state off

You can not disable it, but configure it. To do this, you have to manually console commands include relevant rules. At first I went down this path, then I spat and just turned off the firewall. In most cases on a local network, it is not needed. If you want to leave the firewall behind by configuring it, then here's what you need to open to successfully remotely manage Hyper-V Server 2012 R2:

Access for any mmc console snap-ins:

Netsh advfirewall firewall set rule group="Remote Administration" new enable=yes

Remote Disk Management:

Netsh advfirewall firewall set rule group="Remote Volume Management" new enable=yes

Remote launch of the firewall management snap-in:

Netsh advfirewall firewall set rule group="Windows Firewall Remote Management" new enable=yes

Access to shared files and folders:

Netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes

Using "Windows Management Instrumentation (WMI)":

Netsh advfirewall firewall set rule group="Windows management instrumentation (WMI)" new enable=yes

cscript hvremote.wsf /add:admin_name

This completes the setup of the directly free windows hypervisor for remote control. It is ready to connect and create virtual machines. Now we need to prepare workplace to manage Hyper-V Server 2012 R2.

Remote management of Hyper-V Server 2012 R2

Here I ran into a very unpleasant moment. Remote control requires Windows 8 operating system or Windows Server 2012. My main workplace is on Windows 7. I tried to set up everything that is needed on it, but I didn’t succeed, so I won’t describe my steps. Perhaps there is some working solution, but I did not spend much time looking for it. I did the following.

There is free program. It allows you to manage the Hyper-V Server 2012 R2 hypervisor. Unfortunately, free version greatly reduced in functionality and using only it for full control is not very convenient. But to create and install a virtual machine will do. I used it to install Windows 8.1 on the hypervisor and set up a workplace on it for remote control of the hypervisor.

So, download the program and put it on your computer. We start and add our server. Specify the hypervisor's local admin user as the user:

The first step in the program is to configure the network so that the virtual machine has access to the local area. To do this, go to the Virtual Network Manager tab and click Create. Specify the settings:

Be sure to tick Allow management operation system to share this network adapter. I first created 2 virtual connections on both network adapters and did not check this box. As a result, the hypervisor itself was left without a network. I had to poke around for a very long time and figure out how, having only access to the console, return everything back. It turned out that this can be done using the command:

Set-VMSwitch -Name "local1" -AllowManagementOS 1

And one more important note. After you create a virtual adapter, the network settings of the physical adapter entered earlier will be reset and you will lose access to the server at the old address. Virtual adapter after creation receives settings on DHCP. Keep this in mind. If you have only one network adapter, then you will need to see on the dhcp server what address the hypervisor received and connect to it at this address. Then manually change the address through the management console.

We create a virtual machine. Everything is quite simple and understandable there, it is done by poking the mouse over the menus, I will not dwell on this in detail. If you have a problem with what 5nine cannot connect to the console of the virtual machine and at the same time writes that it is impossible to connect via rdp, then do the following. In file hosts system, write the correspondence of the ip address to the server name and connect to the hypervisor by name, not by ip. I once faced such a problem.

The output is Windows 8.1 connected to the network. We open rdp on it, connect and start preparing it for remote control of the Hyper-V Server 2012 R2 hypervisor.

First of all, we create there local user with the same username and password as on the hypervisor. For convenience, it is better to work under the same user, otherwise you will have to constantly run all the snap-ins, specifying the hypervisor administrator account each time.

10.1.3.3 hyperv

Now let's install the Hyper-V Control Manager. To do this, go to the control panel, open "Programs and Features", press "Turning on and off Windows components» . The list of components will load, in which we tick Hyper-V and click OK:

And on the very client computer I need to open something on the firewall for the snap-in to work, but I just turned it off. Until I did this, Disk Management did not load for me.

FROM remote control disks have one caveat. Perhaps this is just my mistake, but just in case I will tell about it, maybe it will help someone. I spent some time figuring out what's going on here. If you make any changes to the disks, these changes are not displayed. That is, you did something, press refresh, but nothing changes. But in fact, changes have taken place, they are simply not visible. To see them, you need to completely close the Computer Management snap-in and open it again.

Now you can see the system logs, share folders, schedule some task through the scheduler. In general, everything you need to manage the free hypervisor Microsoft Hyper-V Server 2012 R2 is now available.

You can connect to the hypervisor using rdp, the same screen as when working with the monitor will open: the management console and the command line. In it, by the way, you can start the task manager and see the system boot using the command taskmgr:

Linux online course

If you have a desire to learn how to build and maintain highly available and reliable systems, I recommend getting acquainted with online course "Linux Administrator" in OTUS. The course is not for beginners, for admission you need basic knowledge of networks and Linux installation to the virtual The training lasts 5 months, after which successful graduates of the course will be able to be interviewed by partners. What this course will give you:
  • Knowledge of Linux architecture.
  • Development modern methods and tools for data analysis and processing.
  • Ability to select a configuration for the necessary tasks, manage processes and ensure system security.
  • Proficiency in the basic working tools of a system administrator.
  • Understanding the deployment, configuration, and maintenance of Linux-based networks.
  • Ability to quickly resolve emerging issues and provide a stable and smooth operation systems.
Test yourself on the entrance test and see the program for more details.
  • Setting with HVBackup.
  • Windows systems.
  • Beware, actively spreading.
  • Setting .

Top 3 virtualization software market operating systems- VMware, VirtualBox and Hyper-V - the last hypervisor has a special place. This special place is due to the fact that Hyper-V is a standard component of Windows server systems and some versions of Windows for desktop PCs. Yielding to VMware Workstation and VirtualBox in functionality, cross-platform and partly in ease of use, Hyper-V, however, is not without its advantages. And the main one is the higher performance of the guest OS.

Below we will talk about activating Hyper-V on a Windows 10 system and creating a virtual machine using this hypervisor.

1. Hyper-V - a regular hypervisor from Microsoft

The standard Hyper-V component was inherited by Windows 10 from versions of Windows 8 and 8.1, and the hypervisor migrated to them from Windows Server. Both Windows 8.1 and Windows 10 optionally include Hyper-V in the Pro and Enterprise editions. The hypervisor can only work on 64-bit systems.

For a long time, Hyper-V did not support any other guest OS other than Windows. However, relatively recently, Microsoft has taken care of supporting Linux guest OS by the hypervisor. And today, with Hyper-V, you can test some Linux distributions in particular the popular Ubuntu.

2. Requirements for running Hyper-V

Minimum volume random access memory physical computer for running Hyper-V- 4 GB.

The computer processor must support SLAT technology (Intel EPT or AMD RVI). Almost all modern processors meet this requirement.

Another requirement for the processor, also provided by many modern models, is support for hardware virtualization technology and, accordingly, its active state in the BIOS. AT motherboard BIOS boards for Intel processors this technology (depending on the version) may be called differently - Intel-VT, Intel Virtualization Technology, Intel VT-x, Vanderpool or Virtualization Extensions. At AMD technology hardware virtualization is called AMD-V or SVM (Secure Virtual Machines). For example, in AMI BIOS version 17.9, the AMD processor hardware virtualization feature can be found along the path Cell Menu - CPU Feature - SVM Support.

At AMD processors the hardware virtualization feature is usually enabled by default. Does it support specific model processor hardware virtualization, this point can be found on the websites of Intel and AMD.

3. Activate and run Hyper-V

Hyper-V included with Windows 10 Pro and Enterprise is optional. Initially, the regular hypervisor is disabled. It is enabled in the "Programs and Features" section of the control panel. Most fast way to get there is an internal search.

We launch "Turn on and off system components».

In the small window that appears, tick all the sub-items of the Hyper-V item. Click "OK".

The system will apply the changes for a couple of seconds and ask you to reboot. After the reboot, we are looking for a shortcut to launch the Hyper-V Manager. The Hyper-V Manager shortcut can be immediately pinned to the start Windows screen 10 by finding it in the Start Menu Administrative Tools.

The Hyper-V Manager shortcut can also be accessed using an in-system search.

Launch Hyper-V Manager.

4. Setting up network access

In Hyper-V Manager, the network is configured in a separate step, and first you need to create a virtual switch - a setting that provides access to the network. We click on the name of the physical computer, and in the right part of the window, select "Virtual Switch Manager ...".

The wizard for creating a virtual switch will start, where the first step is to select the type of network. There are three of them:

  • External - this type uses network card or Wi-Fi adapter of the physical computer and connects the virtual machine to the same network as the physical computer. Accordingly, this is a type of network that provides access to the virtual machine to the Internet;
  • Internal - This type provides a network between the physical computer and Hyper-V virtual machines, but does not allow them to access the Internet;
  • Private - this type allows you to create a network between Hyper-V virtual machines, but this network will not have a physical computer, nor will it have access to the Internet.

In our case, the access of the virtual machine to the Internet is necessary, therefore we will choose the first type - an external network. Click "Create Virtual Switch".

In the properties window of the virtual switch, give it a name, it can be any name, for example, "Network card 1". Optionally, you can add a note to the virtual switch. If the physical computer has both a network card and a Wi-Fi adapter on board, specific device, through which the virtual machine will connect to the network, you can select from the drop-down list in the "Connection type" column. After the settings are done, click "Apply" at the bottom of the window.

5. Create a virtual machine

Now you can proceed directly to creating a virtual machine. On the left side of the Hyper-V window, the selection should still be on the name of the physical computer. In the upper right corner, click "Create", then - respectively, "Virtual Machine".

In the welcome window of the launched wizard, click "Next".

Give the virtual machine a name; you can also change its location on the disk of a physical computer by specifying desired section disk and desired folder using the browse button. Click "Next".

One relatively new feature of Hyper-V is virtual machine generation selection. In our case, generation 2 is selected.

What does it mean? Generation 1 are virtual machines that support 32-bit and 64-bit Windows systems. Generation 1 compatible with previous versions Hyper-V

Generation 2 - new format virtual machines with built-in software based on UEFI. These virtual machines support a number of new features and can provide a small performance boost. Generation 2 VMs only install 64-bit OSes as guest OSes. Windows versions 8.1 and 10, as well as server Windows Server 2012, Server 2012 R2 and Server 2016.

The UEFI platform imposes another requirement for using generation 2 virtual machines - bootable media UEFI. This point must be clarified by downloading the ISO image with the Windows distribution from third-party sources on the Internet. But it's better to download Windows distributions from official sources. Microsoft. So, the Media Creation Tool utility, which downloads Windows 8.1 distributions from the Microsoft website and creates bootable ISO image, which supports the UEFI environment.

In the case of installing Windows 10 as a guest OS, this is the recommended method for obtaining an ISO image of the system. Windows 10 provides a lazy-type installation process. In our case, Windows 8.1 will be installed as a guest OS, and its official distribution, obtained using the Media Creation Tool, requires a product key to be entered during the installation process. Provide support for the UEFI environment and take advantage of the free opportunity to test Windows system 8.1, the TechNet Trial Software Center site will help. On this site you can download the English edition of 64-bit Windows 8.1 Enterprise and test the system for free for 3 months. The problem with the lack of support for the Russian language after installing the system can be solved separately by installing language pack and setting Russian as the main language of the system.

We return to the virtual machine creation wizard. In the memory allocation window, leave the preset parameters if the physical computer has no more than 4 GB of RAM. If it is more than 4 GB, you can increase the amount allocated when the virtual machine starts. For guest Windows XP, the RAM indicator can, on the contrary, be reduced to 512 MB. Click "Next".

In the network settings window, select the previously created virtual switch from the drop-down list. Click "Next".

In the virtual hard disk connection window, specify a name for the virtual machine, specify the location on the disk of the physical computer, and specify the size. These are the options for creating a new hard drive. The second item of this step of the wizard is used when the computer already has a virtual HDD specifically with a guest OS installed. If you select a generation 2 virtual machine, the virtual hard disk file must be in VHDX (not VHD) format, and the guest OS must support the UEFI boot environment. Click "Next".

If you selected the option to create a new virtual hard disk in the previous step of the wizard, next step will indicate the path to Windows distribution. Generation 2 virtual machines are no longer able to boot from a physical CD/DVD drive. Only the network and the ISO image can be download sources for the guest OS distribution. In our case, this is an ISO image. Click "Next".

The final stage of the wizard - click "Finish".

6. Connecting a virtual machine

Having created the virtual machine, let's return to the Hyper-V Manager window. Now it needs to be connected. To do this, there is a command "Connect" among other commands context menu called on the virtual machine. The Connect command is also present on the right side of the Hyper-V Manager window. To connect, you can also double-click the left mouse button on the preview window of the selected virtual machine.

In the connection window that opens, click the green start button.

The usual process will follow. Windows installation 8.1 as it would on a physical computer.

Once the setup files are copied, you can close the virtual machine connection window and do other things.

Closing the connection window will free up some physical computer resources for other tasks, while the virtual machine will continue to run in the background. Its performance will be displayed in Hyper-V Manager.

You can connect to a virtual machine as you need to perform actions in it.

Everything - Windows 8.1 is installed. You can turn off, suspend, save a virtual machine, or reset its state using both commands in the Hyper-V Manager and buttons on the top panel of the connection window.

7. Boot Priority

In order not to waste time on the boot window from the CD / DVD when you start the virtual machine in the future, you need to open the parameters window in its off state and remove the path to the ISO file with the distribution. This is done in the DVD drive tab of the virtual machine's hardware settings.

Alternative option- raise the hard drive in the boot priority above the DVD drive (but not above the "bootmgfw.efi" file). This is done in the "Firmware" tab of the hardware settings.

In both cases, the changes made are saved with the "Apply" button at the bottom.

8. Bypass Hyper-V Connection Window Limitations

The Hyper-V hypervisor focuses on virtual machine performance, not functionality. Unlike their competitors - VMware and VirtualBox - Hyper-V virtual machines do not work with connected flash drives, do not play sound, and interact with a physical computer only by pasting text copied into the main OS inside the guest OS. That's the price of Hyper-V virtual machine performance. But this is if you work with the usual Hyper-V connection window.

Full integration of a physical computer and a virtual machine can be obtained using the standard remote desktop connection utility.

This utility allows you to flexibly configure connection settings, in particular, make available inside the virtual machine not only those connected to physical computer USB sticks, but also separate sections of the hard disk.

Connecting to a virtual machine in this way will provide audio playback and two-way file transfer in the guest OS.

Have a great day!

Using graphical interfaces such as Hyper-V Manager or System Center Virtual Machine Manager (SCVMM) makes managing Hyper-V quick and easy. However, there are many situations in which you can perform operations much faster if you have the ability to use the command line or scripts. In this article, we'll take a look at Powershell's features for Microsoft management Hyper-V

Powershell installation

First we need to install Powershell.

To install Powershell on Windows 2008, go to server manager, further to Features. Click Add Features. Check windows powershell and press next.

After that click Install.

To launch Powershell go to start-All programs-windows powershell.

At this moment, the long-awaited dark blue will open. Windows window Powershell:

Now we need to download the library Hyper-V Powershell.

Download and install Hyper-V Powershell Library

The developer of the Hyper-V 1397 Powershell management library is James O'Neill and his library is simply invaluable when you have to manage Hyper-V from the command line. Follow the link above and download the file Hyperv.zip. Unzip the archive to some directory, for example C:\temp.

Now start PowerShell, go to the directory with the unpacked scripts, disable PowerShell security with the command:

Set-ExecutionPolicy unrestricted

. c:\temp\hyperv.ps1

After that you will get a security warning and you have to select “ R” to run the script. After that you should see the message “ VM Functions Loaded” and a list of loaded commands.

Administering Hyper-V with PowerShell

Together with the library there is a file Help, which describes more than 100 commands included in the library. And remember that each of these 100 commands has a large number of parameters. Consideration of all the commands and their parameters will not fit in a dozen of such articles, so we will consider the most basic commands and their application.

Let's look at the following 5 commands and how they are used:

    Returns summary information about all guests virtual machines on your Hyper-V server.

    Start-VM, Stop-VM, Suspend-VM, and Shutdown-VM- the purpose of these commands is quite obvious. The name of the virtual machine is specified as a parameter.

    The easiest way to create a new virtual machine


    - a list of all virtual machines on the server and the amount of memory it consumes

The command shows all snapshots taken on your Hyper-V server. To manage snapshots, you can additionally use the commands Update-VMsnapshot, New-VMsnapshot, Apply-VMsnapshot, Get-VMsnapshotTree, and Choose-VMsnapshot.


A good laptop site, I liked acers the most: acer laptop reviews, all models, low prices.