Mastering Windows Server 2016 Hyper-V

(Romina) #1

http://msdn.microsoft.com/en-us/library/cc136850(v=vs.85).aspx


You can create your own custom values within the VM that can be read by the Hyper-
V host by adding string values under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest. This would be
useful to, for example, populate the type of server in the guest using a custom process,
such as SQLServer or IISServer, which could then be read from the host to ascertain
the type of server running in the VM. There is no PowerShell cmdlet available to read
values set in the guest from the Hyper-V host. Instead, you use WMI. The following
PowerShell script reads the fully qualified domain name from within the guest OS
from the Hyper-V host for VM savdaldc02:


$vmName = "savdaldc02"


$vm = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_ComputerSystem
-Filter "ElementName='$vmName'"


$vm.GetRelated("MsvmKvpExchangeComponent").GuestIntrinsicExchangeItems | % {
$GuestExchangeItemXml = ([XML]$
).SelectSingleNode(`
"
/INSTANCE/PROPERTY[@NAME='Name']/VALUE[child::text()='FullyQualifiedDomainName']")


            if  ($GuestExchangeItemXml  -ne $null)
{
$GuestExchangeItemXml.SelectSingleNode( `
"/INSTANCE/PROPERTY[@NAME='Data']/VALUE/child::text()").Value
}
}

Heartbeat   Allows  Hyper-V to  check   the responsiveness  of  the guest   operating
system by a heartbeat check.
Backup (Volume Snapshot) A powerful feature that I cover in Chapter 6,
“Maintaining a Hyper-V Environment; ” this allows backup requests at the host
level to be passed to the guest operating system, in turn allowing consistent file
and application backups to be taken from the host.
Guest Services This is a new Integration Services component introduced in
Windows Server 2012 R2 that is disabled by default. Guest services enables the
copying of files to a virtual machine using WMI APIs or using the new Copy-VMFile
PowerShell cmdlet.

Microsoft provides Integration Services for the supported operating systems unless it
is already part of the operating system; for example, many modern Linux distributions
have the Hyper-V Integration Services built-in (although Microsoft still releases
updated Linux Integration Services, which are then integrated into newer
distributions of Linux). The full list of the supported guest operating systems can be
found at http://technet.microsoft.com/library/hh831531 for Windows Server 2012 R2
and at https://technet.microsoft.com/library/mt126117.aspx for Windows Server 2016,
but the primary supported operating systems for Windows Server 2016 Hyper-V are as

Free download pdf