Export (0) Print
Expand All

CompatibilityCheck.ps1

Updated: August 14, 2009

Applies To: Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1

When you use the Get-VMHostRating cmdlet to get the host ratings for an array of System Center Virtual Machine Manager (VMM) R2 hosts, VMM produces host ratings by comparing the virtual machine against host information in the VMM database. Then, to determine which of the highly-rated hosts in the array is most compatible for live migration with the virtual machine you want to migrate, you can perform a direct validation of the virtual machine against each potential host. When you supply a single VMM host that is running Windows Server 2008 R2 or VMware to the Get-VMHostRating cmdlet, the cmdlet compares the running state of the virtual machine directly against the host and returns a rating that is more representative of the virtual machine's actual compatibility with the host.

If you encounter processor incompatibility issues when checking for host compatibility, you can set compatibility options that limit CPU functionality on the virtual machine. For a sample script that shows how to set compatibility options, see SetProcessorCompatibility.ps1.

The following script gets the host ratings for all of the hosts in a host group. Next, the script performs a direct validation of the specified virtual machine against each host in the host group that had an original host rating greater than zero. Then, the script returns the host ratings for each host.

Disclaimer


# Filename: CompatibilityCheck.ps1
# Description:Compares a virtual machine against hosts in a VMM host 
#      group for host ratings. Next, the script performs a 
#      direct validation of the virtual machine against each
#      host that had an original host rating greater than zero.
#      Then, it returns a rating for each host.

# Connect to the VMM server.

$VMMServer = Get-VMMServer -ComputerName "VMMServer01.Contoso.com"

# Supply the name of the virtual machine that you want to move.
$VMName = "VM01"

# Supply the host group in which to deploy the virtual machine later in the script.
$VMHostGroup = Get-VMHostGroup -Name "All Hosts"

# Get the host ratings for all the hosts in the host group that had an original host rating
# greater than zero.
$VMHostRatings = Get-VMHostRating -VM $VMName -VMHostGroup $VMHostGroup -CPUPriority 6 -DiskPriority 5 -MemoryPriority 4 -NetworkPriority 4 -PlacementGoal "Consolidate" -IsMigration | where { $_.Rating -gt 0 } 

If($VMHostRatings.Count -eq "0") {throw "No hosts meet the requirements."}

# If there is at least one host that will support the virtual machine,
# perform a direct validation of the virtual machine against the host.
Foreach ($VMShallowRating in $VMHostRatings)
{
   $ValidationRating = Get-VMHostRating -VM $VMName -VMHost $VMShallowRating.VMHost -CPUPriority 6 -DiskPriority 5 -MemoryPriority 4 -NetworkPriority 4 -PlacementGoal "Consolidate" -IsMigration
   Write-Output $ValidationRating
}


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft