Installing and configuring hyper v. Installing and configuring hyper-v server for those who see it for the first time


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 look at Powershell's capabilities for managing Microsoft Hyper-V.

Installing Powershell

First, we need to install Powershell.

To install Powershell on Windows 2008, go to Server Manager, further in 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 Windows Powershell window will open:

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

Download and install Hyper-V Powershell Library

The developer of the Powershell management library for Hyper-V 1397 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. Unpack the archive into a directory, for example C:\temp.

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

Set-ExecutionPolicy unrestricted

. c:\temp\hyperv.ps1

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

Administering Hyper-V using PowerShell

Along with the library there is a help file that describes more than 100 commands included in the library. And remember that each of these 100 commands has a large number of parameters. A review of all the commands and their parameters would not fit into a dozen similar articles, so we will look at the most basic commands and their use.

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

    Provides summary information about all guest 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 parameter specifies the name of the virtual machine.

    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.


Not a bad laptop site, I liked the Acers the most: reviews of Acer laptops, all models, low prices.

Hello friends, in today’s article we will connect a Hyper-V virtual machine to our Windows 8 and install the Windows 7 and Windows 8 operating systems on it, and also answer all the questions asked by users. By the way, you can transfer your entire physical computer to Hyper-V! Several system administrators I know work only on Hyper-V and have even forgotten what a normal operating system is. At the very beginning we publish several of your letters.

Installing Hyper-V

If you have Windows 8 Pro or Windows 8 Enterprise (corporate) installed on your computer, then you can use the Hyper-V virtualization system or, in simple words, use the virtual machine built into the Windows 8 operating system. It is very easy to use and I have no doubt that you will understand it.

For Hyper-V to work, your processor must support virtualization technology. Before work, be sure to enable the following options in the computer BIOS:

"Intel Virtualization Technology" for Intel processors or "AMD Virtualization" for AMD processors.

I warn you that Hyper-V is primarily designed and intended for IT professionals and is used on servers.

When working in Hyper-V, you will not be able to use a flash drive, sound card, and WiFi; in this regard, it is preferable to use VirtualBox. But I still think that those who read this article know why they need it.

For its operation, the Hyper-V virtual machine makes small requirements:

Windows 8 Pro must be 64 bit.

Availability of at least 4GB of RAM.

Hyper-V connection

Opening Control Panel

and choose Programs

Programs and components. Turn Windows features on or off

Find the Hyper-V partition and mark it with a checkmark and click OK.

There will be a short search for the required files and a reboot.

After the reboot, go to the Metro interface and left-click on the arrow, then select Hyper-V Manager,

The Hyper-V Setup Wizard appears. Click on the name of our computer, then Create And Virtual machine.

Hyper-V Settings

1) Getting started. This wizard will help you create a virtual machine, click Next.

2) Specify a location. We assign a name to the virtual machine in Latin, for example Windows 7. We indicate the location of the files of the Hyper-V virtual machine, since I don’t have space on drive C:, I will check the Save virtual machine in another location checkbox and click browse, then specify the drive D: and Next.

3) Specify the generation. I want to install Windows 7 so I will select Generation 1.

4) Allocate memory. My computer has 8GB of RAM, which means I can safely allocate 2GB of RAM for a virtual machine. Check the box “Use dynamic memory for this virtual machine” and Next.

5) Network setup. We skip this parameter (we’ll set up an Internet connection later) and click Next.

6) Connect the virtual hard disk. Mark the item Create a virtual hard disk. So in the second paragraph Specify location, we indicated the location of the virtual machine files on the D: drive, then by default the virtual machine will offer us to locate the virtual hard disk on the D:\Windows 7\Virtual Hard Disks\ drive.

Friends, the item Size 127 GB does not mean that 127 GB will immediately be “squeezed out” on your D: drive.

Note: A virtual hard disk can be created at the very beginning, that is, before you create a virtual machine, and in this case you can choose which virtual hard disk to create, for example:

Dynamic(grows in volume gradually, according to accumulated data, at first it takes up several megabytes).

Fixed size(immediately requires allocation for the required space; if you create a 120 GB disk, that means you must allocate exactly that much space to it).A fixed-size hard drive is considered to have higher performance.

See the end of the article for more details.

7) Installation parameters. Check the box Install the operating system later. Further.

8) Done

How to set up Internet in Hyper-V

Now let's set up the network. In the main Hyper-V window, click on the Virtual Switch Manager button.

In the window that appears, select what type of virtual switch you want to create. I will select the type - External network. WITH create a virtual switch.

Choose an arbitrary name for the virtual switch. The Wi-Fi network adapter on my computer is from Atheros, so I’ll choose that name. Apply.

Choose Options


A window will open, on the left side of which you can see two sections with different parameters; if you select the parameter you need with the left mouse, then on the right side of the window you can configure it.

Network adapter. In the right part of the window, select our Virtual Switch "Atheros", Apply And OK.

Installation on Hyper-V operating system

Now the actual question is how to install the operating system in a virtual machine. To install a Hyper-V virtual machine, you need to boot it from the Windows 7 installation disk located in the drive or for these purposes you need to use an ISO image with Windows.

, then on the right side of the window using the buttons Up And Down We set the virtual machine boot to what we need:

CD- boot from installation disk or ISO image.

Choose Controller 1 IDE and click on the plus sign, then DVD drive, if you want to boot the virtual machine from the DVD drive, check the item Physical CD and DVD drive: then insert the Windows 7 installation disk into the drive.

Also, to boot a virtual machine and install an ISO image with Windows 7, you can use Windows 7, in this case you need to check the File image item and click the Browse button, in the explorer that opens you need to select the image with Windows 7 and click Open. Apply and OK.

Click Start and the virtual machine starts. Hyper-V is loading from the Windows 7 ISO image. Double-click with the left mouse on the thumbnail of the Hyper-V virtual machine window,

A window will open in which you and I will work. Press any key, otherwise booting from the Windows 7 installation disk will not occur. At the top of the window there are virtual machine settings buttons.

The usual Windows 7 installer dialog box. Next, you can install the Windows 7 operating system on the virtual machine. The whole process is described in detail in our article.

So you and I connected a Hyper-V virtual machine to our operating system and installed Windows 8 on it, the Internet is present on the virtual machine. You can install Windows 8 on it in exactly the same way.

How to create a virtual hard disk in Hyper-V

Friends, a virtual hard disk in Hyper-V can be created not only during the process of creating a virtual machine.

In the main window of the virtual machine, select Create -> HDD


Selecting the disc format. You can choose a new hard drive format, but please note that it is not supported by earlier operating systems before Windows 8

Select the disk type. You can create a fixed partition disk, which is considered higher performance

We indicate the location of the virtual hard disk, if you have little free space on the C: drive, then place the virtual hard disk on the D: drive. Click on the Browse button and select drive D:

Disk setup. If we create not a dynamic expandable virtual disk, but a virtual disk of a fixed partition, then we must specify the exact size of the disk; if we specify the size of 127 GB, then this is exactly how much our virtual disk will occupy on the D: drive. Make sure you have enough free space on your D: drive.

note per parameter Copy the contents of the specified physical disk, you can use it if you want to transfer your physical computer along with all the settings to a virtual machine!

The virtual hard disk has been created. When creating a new virtual machine in step Connect a virtual hard disk we can check the box Use an existing virtual hard disk, then click Browse and specify the location of the virtual disk -D:\New virtual hard disk.vhdx

Blue screen when creatingvirtual switch in Hyper-V

Friends, several times I had to deal with the fact that in the new Windows 8.1 operating system in the Hyper-V virtual machine, when creating a virtual switch, the operating system went to a blue screen with the error:

The problem seems to be caused by the following file: fwpkclnt.sys UNEXPECTED_KERNEL_MODE_TRAP *** STOP: 0x0000007f.

I tried to solve the problem in various ways: by reinstalling the virtual machine, restoring system files, removing the antivirus and firewall, updating drivers for all computer components, including the network card. Unfortunately, only changing the network adapter helped.

We will add the components Hyper-V in Windows 10, consider the option of creating a virtual machine using Hyper-V, and also consider its parameters.

Adding Hyper-V components.

Let's launch "Run" in any of two ways:

  1. Right click on the menu "Start" and choose "Run".(Fig.1)
  2. Press the key combination "Win"+"R".
Fig.1 - Right click "Start" -> "Run".

Enter appwiz.cpl(Fig.2)


Fig.2 - Enter appwiz.cpl

A window will open "Programs and Features". Click on the left "Turn Windows features on or off".(Fig.3)


Fig.3 - Programs and components.

A window will open "Windows Components". Select everything that is in the section Hyper-V.(Fig.4)

Click "OK".

Fig.4 - Selecting Hyper-V components.

We are waiting for the components to be installed - Applying changes, and press "Restart now".(Fig.5)


Fig.5 - Using components, rebooting the system.

On this Adding Components finished. Getting started with Hyper-V

Launching Hyper-V.

On the menu "Start" -> "Windows Administrative Tools" a shortcut appeared "Hyper-V Manager". Let's launch it. (Fig. 6)

Fig.6 - Launch Hyper-V Manager.

Before us is the start window "Hyper-V Manager".(Fig.7)


Fig.7 - Hyper-V Manager start window.

We select our computer on the left, I have this - DESKTOP-9PLBR7Q, a menu will appear on the right "Actions", Click on the item "Virtual Switch Manager".(Fig.8)


Fig.8 - Go to the Virtual Switch Manager.

IN "Virtual Switch Manager" click "Create a virtual switch".(Fig.9)


Fig.9 - Creating a virtual switch.

Enter Name, I have this - Hypernet and note, I have this - Hyper-V network.(Fig.10)

You will also choose Connection type. I chose to connect to External network via my network card - "Realtek PCIe GBE Family Controller". And also checked the checkbox "Allow the management operating system to share this network adapter".

Click "Apply".


Fig. 10 - Properties of the virtual switch.

A warning pops up "Pending changes may disrupt network connectivity".(Fig. 11) I assume that this article will be read by beginners, which means they are unlikely to repeat step by step after me, using the involved server, of their enterprise 😀 . Therefore, it’s okay that we may lose our network connection for a while. Click "Yes" and wait "Applying Changes".


Fig. 11 - Warning about a possible network connection failure.

Now having entered "Network connections" -> "Configuring adapter settings". We can see our newly created vEthernet (Hypernet), also adjacent to it is not connected vEthernet (Default Switch) - " Standard Network automatically grants virtual machines access to the computer's network using network address translation ( NAT). NAT We are not interested at the moment. And we will not touch this switch. (Fig. 12)


Fig.12 - Network connections -> Configuring adapter parameters.

This completes the network setup. Let's move on to the most important thing, why the virtualization system was created Hyper-V- WITH creating a virtual machine.

Creating a virtual machine.

Right click on our computer -> "Create" -> "Virtual machine". (Fig.13)


Fig. 13 - Creating a Hyper-V virtual machine.

The “Virtual Machine Creation Wizard” will open (Fig. 14)

  • Click the button "Ready" to create a virtual machine with default settings.
  • Click the button "Further" to create a virtual machine with specific configuration settings.

Fig. 14 - Virtual machine creation wizard.

Specify the name of the virtual machine and its location. (Fig. 15)

I decided to test with Ubuntu Server 18.04.

So this is what I have:

  • Name: ubuntuserver 18.04.
  • Location: E:\hyper-v ubuntu server 18.04\.

Fig.15 - Specify the Name of the virtual machine and its location.

Select the generation of the virtual machine. (Fig. 16)

In most cases, you should choose the second generation, but if you are installing something 32-bit something worth choosing - Generation -1.

For me personally Ubuntu Server 18.04 64-bit with the support UEFI, therefore I choose - Generation 2.


Fig. 16 - Select the generation of the virtual machine.

We select the amount of RAM. (Fig. 17)

My operating system is enough 1Gb RAM=> I leave the default ones included 1024 Mb. Let's go "Further".


Fig. 17 - Allocating the amount of RAM.

We select which switch our network interface will be connected to. (Fig. 18)

Choose our "Hypernet", let's go "Further".


Fig. 18 - Network setup.

Create a virtual hard disk. (Fig. 19)

We indicate Name,Location and maximum Size virtual file HDD.

I have so:

  • Name: ubuntu server 18.04.vhdx.
  • Location: E:\hyper-v ubuntu server 1804\.
  • Size: 10 GB.

Fig. 19 - Creating a virtual hard disk.

Choose ISO image from which we will install the operating system. (Fig. 20)

Select an item "Install operating system from boot image file"-> Click "Review"-> Choose iso image. -> Click "Further".


Fig.20 - Selecting an OS image.

Completing the virtual machine creation wizard (Fig. 21)

Click "Ready".


Fig.21 - Completing the virtual machine creation wizard.

Now in Hyper-V Manager we see a newly created virtual machine - ubuntu server 1804. (Fig.22)

Right-click on it -> "To plug".


Fig.22 - Hyper-V Manager, New virtual machine.

A window will appear (Fig. 23)

If you want to install the system Windows then when you press the button "Start" The installation should start without any errors.

But in order to start Ubuntu Server 18.04 I had to "File" - > "Options"->"Safety" disable "Secure Boot".(Fig.24)


Fig.23 - Connecting to a virtual machine.
Fig.24 - Disable Secure Boot.

Turn on the virtual machine. (Fig. 25)


Fig.25 - Turn on the virtual machine.

Everything is fine, the virtual machine started. The installer meets us Ubuntu Server 18.04.(Fig.26)


Fig.26 - Running virtual machine. Ubuntu Server 18.04 installer.

Changing virtual machine settings.

Let's make a short overview of the virtual machine parameters so that you can see the main functions before you decide to use the virtualization system Hyper-V.

"File" - > "Options".(Fig.27) Fig.27 - Go to "File" -> "Options"

Equipment.

"Firmware"- you can change the boot priority of devices in the virtual machine. (Fig. 28)


Fig.28 - Selecting boot priority.

"Safety"- Can "Enable/Disable Secure Boot", "Enable/Disable encryption support".(Fig.29)

Fig.29 - Security parameters of the virtual machine.

"Memory"- you can edit the amount allocated RAM, Enable/Disable function Dynamic memory.(Fig.30)


Fig.30 - RAM parameters.

"CPU"- you can edit the number of virtual processors in accordance with the number of processors on the physical computer. (Fig. 31)

You can also distribute the load across "Resource management".


"SCSI controller" can add HDD,DVD drive or Shared drive.(Fig.32)


Fig.32 - SCSI controller parameters.

You can also change parameters of connected media, for example here we can change inserted into virtual DVD drive ISO image (Fig. 33)


Fig.33 - Media parameters.

"Network adapter" you can change the configuration network adapter: Choose Virtual switch, register VLAN ID, configure Bandwidth.(Fig.34)


Fig.34 - Network parameters.

Control.

"Name"- you can easily change the virtual machine to one more convenient for your use. (Fig. 35)


Fig.35 - Changing the name.

"Integration Services"- Selecting the services that you want to make available to the virtual machine. .(Fig.36)


Fig.36 - Integration services.

"Checkpoints"- Here you can configure Checkpoints( snapshot, recovery points), enable automatic creation mode and designate their storage location. (Fig. 37)


Fig.37 - Control points.

"Smart Padding File Location"- You can specify the path to the swap file.(Fig.38)

Smart Padding- a function that makes it possible, if there is insufficient memory to boot a virtual machine, to use a swap file on the host.


Fig.38 - Smart Padding file location.

"Automatic startup actions"- You can select the operation that you want to perform with this virtual machine when starting the physical computer. (Fig. 39)

Continuing the series of articles on virtualization, today we will talk about setting up a network in Hyper-V. We will focus on theory, namely, we will analyze how virtual networks are structured and how they interact with real ones. Because, as practice shows, many administrators, in the absence of simple and understandable materials on this issue, are forced to master network setup in Hyper-V using the “scientific poker” method.

On the one hand, there is nothing complicated in setting up networks for virtual machines, on the other hand, many begin to get confused in all these adapters, having difficulty understanding where the real one is, where the virtual one is, and how they differ from each other. Let's try to clarify.

Responsible for setting up networks in Hyper-V Virtual Switch Manager, if we open it, we will see the following picture:

Private network

A private network differs from an internal network in that a virtual switch can only be connected to virtual machines and is isolated from the host.

This type of network can also be used for educational and research purposes, as well as for creating isolated sections of the network, for example DMZ.

In this case, communication between the external and private network will be carried out through one of the virtual machines, which must be connected to both networks.

As you can see, Hyper-V puts in the hands of the administrator a very flexible and powerful tool that allows you to create and manage very complex network configurations.

Some time ago we wrote about autostart of VMware vSphere and Citrix XenServer virtual machines, but Microsoft Hyper-V administrators also encounter this problem. Just like on the vSphere platform, Hyper-V has settings to control the behavior of virtual machines when the host server is turned on and off.

So, if you open the virtual machine settings in Hyper-V, you will see an item like Automatic Start Action, where the settings for the behavior of the VM when the host starts are actually set:

There are three options for how the machine behaves when starting the Hyper-V host:

  • Nothing - By default, the virtual machine does not start when the host server starts.
  • Automatically Start If It Was Running When The Service Stopped - This option is useful when testing various applications in the VM (which, for example, can reboot the host) and the presence of machines that do not always turn on, but as needed. If you select this item, the virtual machine will be launched only if it was running when the host was shut down or rebooted.
  • Start This Virtual Machine Automatically - This option is best used for productive virtual machines. It will allow you to start the virtual machine when the host starts in any case. There is also an option to delay before starting the VM, which will allow you to configure the order in which dependent services are launched (for example, we start the Active Directory controller without delay, then the Microsoft SQL database, and after a while we start the application server and web server). In addition, this option will prevent all machines from creating a load on the storage subsystem at the same time, distributing it over time.

In addition to autostart of virtual machines, you can also configure Automatic Stop Action- action performed when the Hyper-V host server is shut down. This is also in the properties of the virtual machine:

There are also 3 behavior options here:

  • Save The Virtual Machine State- this option allows you to minimize the downtime of the virtual machine in the event of a host shutdown. If a scheduled shutdown occurs, the virtual machine's memory will be saved to disk, after which the machine will be suspended. When you turn on the virtual machine, its memory will be restored, and it will continue to function as if nothing had happened (though not in all cases). This saves the time required to load and initialize guest OS services. However, if the amount of RAM required by a VM is large, the time it takes to unload it to and from disk can also take a significant amount of time. This option is enabled by default.
  • Turn Off The Virtual Machine- this option will “hard” shut down the virtual machine (analogous to a sudden power outage). In this case, nothing will be saved, plus there are no guarantees of data consistency inside the VM (and as a result, there are no guarantees that it will load at all). But this happens the fastest, so it is convenient when using a test environment, where data safety is not so important, and everything needs to be done quickly. In addition, such a shutdown is guaranteed to occur, unlike the next or previous points.
  • Shutdown The Guest Operating System- in this case, a graceful shutdown procedure is initiated in the guest OS. The system state will also not be saved, but most likely the system state will be consistent, since read-write operations will be completed correctly. If this option is used, then you need to configure the boot order of systems accordingly in the previous paragraph (autostart), since it takes time to initialize the OS and services when starting virtual machines.

Here we must not forget that if you have selected the “Save The Virtual Machine State” option, then you will need significant disk space for the .BIN files in which the virtual machine memory is located (the sum of the VM memory with this setting).







2024 gtavrl.ru.