Export (0) Print
Expand All
Expand Minimize

Get-SCVMHostRating

Updated: September 27, 2012

Applies To: System Center 2012 - Virtual Machine Manager

Get-SCVMHostRating

Calculates the placement rating for one or more hosts managed by VMM on which you might want to deploy a specific virtual machine.

Syntax

Parameter Set: FromVMClouds
Get-SCVMHostRating -Cloud <Cloud[]> -VM <VM> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-HighlyAvailable <Boolean> ] [-IsCloudOnlyRating] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VMName <String> ] [ <CommonParameters>]

Parameter Set: FromVMHostGroups
Get-SCVMHostRating -VM <VM> -VMHostGroup <HostGroup[]> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-HighlyAvailable <Boolean> ] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VMName <String> ] [ <CommonParameters>]

Parameter Set: FromVMHosts
Get-SCVMHostRating -VM <VM> -VMHost <Host[]> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-HighlyAvailable <Boolean> ] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VMName <String> ] [ <CommonParameters>]

Parameter Set: NewVMClouds
Get-SCVMHostRating -Cloud <Cloud[]> -DiskSpaceGB <UInt16> -HardwareProfile <HardwareProfile> -VMName <String> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-IsCloudOnlyRating] [-IsMigration] [-JobGroup <Guid> ] [-LUNCountRequirement <UInt32> ] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-OperatingSystem <OperatingSystem> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]

Parameter Set: NewVMCloudsConfig
Get-SCVMHostRating -Cloud <Cloud[]> -VMConfiguration <BaseVMConfiguration> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-DiskSpaceGB <UInt16> ] [-IsCloudOnlyRating] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]

Parameter Set: NewVMCloudsTemplate
Get-SCVMHostRating -Cloud <Cloud[]> -DiskSpaceGB <UInt16> -VMName <String> -VMTemplate <Template> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-IsCloudOnlyRating] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]

Parameter Set: NewVMHostGroups
Get-SCVMHostRating -DiskSpaceGB <UInt16> -HardwareProfile <HardwareProfile> -VMHostGroup <HostGroup[]> -VMName <String> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-IsMigration] [-JobGroup <Guid> ] [-LUNCountRequirement <UInt32> ] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-OperatingSystem <OperatingSystem> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]

Parameter Set: NewVMHostGroupsConfig
Get-SCVMHostRating -VMConfiguration <BaseVMConfiguration> -VMHostGroup <HostGroup[]> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-DiskSpaceGB <UInt16> ] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]

Parameter Set: NewVMHostGroupsTemplate
Get-SCVMHostRating -DiskSpaceGB <UInt16> -VMHostGroup <HostGroup[]> -VMName <String> -VMTemplate <Template> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]

Parameter Set: NewVMHosts
Get-SCVMHostRating -DiskSpaceGB <UInt16> -HardwareProfile <HardwareProfile> -VMHost <Host[]> -VMName <String> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-IsMigration] [-JobGroup <Guid> ] [-LUNCountRequirement <UInt32> ] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-OperatingSystem <OperatingSystem> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]

Parameter Set: NewVMHostsConfig
Get-SCVMHostRating -VMConfiguration <BaseVMConfiguration> -VMHost <Host[]> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-DiskSpaceGB <UInt16> ] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]

Parameter Set: NewVMHostsTemplate
Get-SCVMHostRating -DiskSpaceGB <UInt16> -VMHost <Host[]> -VMName <String> -VMTemplate <Template> [-CPUExpectedUtilizationPercent <UInt16> ] [-CPUPriority <UInt16> ] [-DiskIOExpectedCountPerSecond <Int32> ] [-DiskPriority <UInt16> ] [-IsMigration] [-MemoryPriority <UInt16> ] [-NetworkPriority <UInt16> ] [-NetworkUtilizationExpectedMbps <Int32> ] [-PlacementGoal <EnginePlacementGoals> ] [-UseDefaultPath] [-VirtualizationPlatform <VirtualizationPlatform> ] [ <CommonParameters>]




Detailed Description

The Get-SCVMHostRating cmdlet calculates the placement rating for one or more hosts managed by System Center Virtual Machine Manager (VMM) on which you might want to deploy a specific virtual machine.

The rating indicates the suitability of a computer to serve as a host for a virtual machine that requires a specific hardware configuration. The rating can be computed by individual host, for an array of hosts, or for each host that belongs to a specific host group or set of host groups.

When you run the Get-SCVMHostRating cmdlet, VMM returns an SCVMHostRating object for each of the specified hosts based on the hardware configuration that you want on the virtual machine. You can also specify additional placement options in order to modify how the ratings are calculated.

If you supply multiple host objects or an array of host objects to Get-SCVMHostRating, VMM gathers information about the host objects from the VMM database. To produce a host rating, VMM then compares the running state of the virtual machine against the database information. This operation does not guarantee migration compatibility of the virtual machine with a target host.

If you supply a single host object that is running Windows Server 2008 R2, or later, VMware, or Citrix XenServer to Get-VMHostRating, the cmdlet performs a direct validation of the running state of the virtual machine against the target host. Performing a direct validation ensures migration compatibility of the virtual machine. When performing the direct validation, the command might take several seconds to complete.

For more information about Get-SCVMHostRating, type: "Get-Help Get-SCVMHostRating -online".

Parameters

-Cloud<Cloud[]>

Specifies a private cloud object.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CPUExpectedUtilizationPercent<UInt16>

Specifies the percent of CPU on the host that you expect this virtual machine to use. This value is used only when VMM determines a suitable host for the virtual machine.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CPUPriority<UInt16>

Specifies the relative importance of CPU utilization for a virtual machine on a host. To make CPU utilization a higher priority relative to other factors (such as disk I/O performance, memory utilization, and network utilization), set this value to a higher number. Valid values: 0 through 10. Default value: 5.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DiskIOExpectedCountPerSecond<Int32>

Specifies the number of disk input/output operations per second (IOPS) that you expect this virtual machine to use.

Example format: -DiskIO 1500 (to specify 1500 IOPS).


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DiskPriority<UInt16>

Specifies the relative importance of disk input/output (I/O) performance for a virtual machine on a host. To make disk I/O performance a higher priority relative to other factors (such as CPU utilization, memory utilization, and network utilization), set this value to a higher number. Valid values: 0 through 10. Default value: 2.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DiskSpaceGB<UInt16>

Specifies, in gigabytes (GB), the amount of hard disk space on the host that can be used by a specific virtual machine.

Example: -DiskSpaceGB 20 (to specify 20 GB of disk space)


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-HardwareProfile<HardwareProfile>

Specifies a hardware profile object.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-HighlyAvailable<Boolean>

Specifies that a virtual machine will be placed on a Hyper-V host that is part of a host cluster. Configure this setting on a virtual machine, or on a template or hardware profile that will be used to create virtual machines.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IsCloudOnlyRating

Indicates that the rating only applies to a private cloud.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IsMigration

Specifies that a rating indicating a computer"s suitability as a host to which to move a virtual machine will be calculated even if the source and destination host is the same computer.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobGroup<Guid>

Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LUNCountRequirement<UInt32>

Specifies the number of LUNs required by a virtual machine when evaluating which computers are suitable hosts on which to deploy this virtual machine.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MemoryPriority<UInt16>

Specifies the relative importance of memory utilization by a virtual machine on a host. To make memory utilization a higher priority relative to other factors (such as CPU utilization, disk I/O performance, and network utilization), set this value to a higher number. Valid Values: 0 through 10. Default value: 8.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NetworkPriority<UInt16>

Specifies the relative importance of network utilization by a virtual machine on a host. To make network utilization a higher priority relative to other factors (such as CPU utilization, disk I/O performance, and memory utilization), set this value to a higher number. Valid values: 0 through 10. Default value: 2.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NetworkUtilizationExpectedMbps<Int32>

Specifies, in megabits per second (Mbps), the amount of traffic on the physical host"s network that you expect this virtual machine to use.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OperatingSystem<OperatingSystem>

Specifies the type of operating system for a virtual machine. To list the names of all available operating systems in VMM, type: "Get-SCOperatingSystem".


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-PlacementGoal<EnginePlacementGoals>

Specifies the placement algorithm to use when VMM selects the most suitable host on which to deploy a virtual machine. Load balancing among hosts lets VMM minimize the processing load on any one host. Consolidation lets VMM maximize resources by combining multiple low-utilization workloads on a single host. Valid values: LoadBalance, Consolidate.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UseDefaultPath

Specifies that only volumes for which a default path has been set on the host will be evaluated as possible candidates for virtual machine placement. If you omit this parameter or if no default paths are set on the host, all volumes will be evaluated by the placement process.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VirtualizationPlatform<VirtualizationPlatform>

Specifies the virtualization platform of a virtual machine host managed by VMM. Valid values are: HyperV, VMwareESX, XENServer.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VM>

Specifies a virtual machine object.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-VMConfiguration<BaseVMConfiguration>

Specifies a virtual machine configuration object.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-VMHost<Host[]>

Specifies an array of virtual machine host objects.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-VMHostGroup<HostGroup[]>

Specifies a virtual machine host group object or an array of host group objects.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-VMName<String>

Specifies the name of a virtual machine to be placed on a physical host server. Use this parameter to verify that another virtual machine with the same name is not already deployed on that host.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMTemplate<Template>

Specifies a VMM template object used to create virtual machines.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • VMHostRating

Examples

1: Calculate host ratings for a specific server as a possible host for an existing virtual machine.

The first command gets the virtual machine object named VM01 and stores the object in the $VM variable.

The second command gets the host object named VMHost02 and stores the object in the $VMHost variable.

The third command returns the placement rating for VMHost02 that indicates its suitability as a host for VM01 and stores the rating information in the $HostRating variable.

The last command displays the host ratings stored in $HostRating to the user.

NOTE: Because the preceding example supplies a single host object to Get-SCVMHostRating, if the host is running Windows Server 2008 R2, or later, VMware, or XenServer, it will perform a direct validation of the running state of the virtual machine against the target host to ensure migration compatibility of the virtual machine.


PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost02.Contoso.com"PS C:\> $HostRating = Get-SCVMHostRating -VM $VM -VMHost $VMHostPS C:\> $HostRating

2: Calculate host ratings for each server in a host group as a possible host for an existing virtual machine.

The first command gets the virtual machine object named VM02 and stores the object in the $VM variable.

The second command gets the host group object that named HostGroup02 and stores the object in the $VMHostGroup variable.

The third command returns the placement ratings for all hosts in the specified host group and indicates the suitability of each host in that host group as a host for VM02. The command stores the rating information in $HostRatings.

The last command displays the host ratings stored in $HostRating to the user.

NOTE: Because the preceding example supplies multiple host objects to Get-SCVMHostRating, it will not perform a direct validation of the virtual machine against the hosts to produce host ratings. To ensure migration compatibility, you should perform a direct validation by running the Get-SCVMHostRating cmdlet on each potential target host individually.


PS C:\> $VM = Get-SCVirtualMachine -Name "VM02"PS C:\> $VMHostGroup = Get-SCVMHostGroup -Name "HostGroup02"PS C:\> $HostRatings = Get-SCVMHostRating -VM $VM -VMHostGroup $VMHostGroupPS C:\> $HostRatings

3: Calculate host ratings for each server in a host group as a possible host for a new virtual machine.

The first command gets the host group object named HostGroup03 and stores the object in the $VMHostGroup variable.

The second command gets the hardware profile object named "HWProfile01" and stores the object in the $HWProfile variable.

The third command returns the placement ratings for all hosts in the specified host group for a new virtual machine and stores the placement ratings in $HostRatings. Before determining the host ratings, this command modifies the priorities for various factors by using the following parameters to specify these values: DiskSpaceGB, CPUPriority, MemoryPriority, DiskPriority, and NetworkPriority. See the individual parameter descriptions for additional information.

The last command displays the host ratings stored in $HostRatings to the user.

NOTE: Because the preceding example supplies multiple host objects to Get-SCVMHostRating, it will not perform a direct validation of the virtual machine against the hosts to produce host ratings. To ensure migration compatibility, you should perform a direct validation by running the Get-SCVMHostRating cmdlet on each potential target host individually.


PS C:\> $VMHostGroup = Get-SCVMHostGroup -Name "HostGroup03"PS C:\> $HWProfile = Get-SCHardwareProfile | where {$_.Name -eq "HWProfile01"}PS C:\> $HostRatings = Get-SCVMHostRating -VMHostGroup $VMHostGroup -HardwareProfile $HWProfile -DiskSpaceGB 20 -VMName "VM03" -CPUPriority 8 -MemoryPriority 5 -DiskPriority 3 -NetworkPriority 1PS C:\> $HostRatings

4: Calculate host ratings for each host in an array as a possible host for a new virtual machine.

The first command gets the operating system object that represents a 64-bit edition of Windows Server 2008 R2 Standard edition and stores the object in the $OS variable.

The second command generates a GUID and stores the GUID in $JobGroupID. The job group ID functions as an identifier that groups subsequent commands into a single job group.

The third command creates a new virtual disk drive with the specified properties, but uses the job group ID to specify that the virtual disk drive is not created until just before the Get-SCVMHostRating cmdlet in the last command runs.

The fourth and fifth commands retrieve an array of host objects and a specific hardware profile object to pass into the Get-VMHostRating cmdlet in the next command.

The sixth command returns the placement ratings for all hosts in the specified host list and indicates the suitability of each host in that list for the new virtual machine with the specified characteristics. The command stores the rating information in $HostRatings.

Before the Get-SCVMHostRating cmdlet returns the host ratings, the command uses the JobGroup parameter to run the New-SCVirtualDiskDrive command from the third command so that the Get-SCVMHostRating cmdlet includes the virtual disk drive and its settings when calculating placement ratings.

The last command displays the host ratings stored in $HostRatings to the user.

NOTE: Because the preceding example supplies an array of host objects to Get-SCVMHostRating, it will not perform a direct validation of the virtual machine against the hosts to produce host ratings. To ensure migration compatibility, you should perform a direct validation by running the Get-VMHostRating cmdlet on each potential target host individually.


PS C:\> $OS = Get-SCOperatingSystem | where {$_.Name -eq "64-bit edition of Windows Server 2008 R2 Standard"}PS C:\> $JobGroupID = [guid]::NewGuid()PS C:\> New-SCVirtualDiskDrive -SCSI -Fixed -Bus 0 -Lun 2 -Size 10 -JobGroup $JobGroupID -FileName "TestDiskDrive"PS C:\> $VMHosts = Get-SCVMHostPS C:\> $HWProfile = Get-SCHardwareProfile | where { $_.Name -eq "HWProfile01" }PS C:\> $HostRatings = Get-SCVMHostRating  -DiskSpaceGB 10 -HardwareProfile $HWProfile -VMHost $VMHosts -VMName "VM04" -OperatingSystem $OS -JobGroup $JobGroupIDPS C:\> $HostRatings

5: Calculate host ratings for a specific VMM management server as a possible host for an existing virtual machine.

The first command gets the virtual machine object named VM05 and stores the object in the $VM variable.

The second command gets the host object named VMHost05 and stores the object in the $VMHost variable.

The third command returns the placement rating for VMHost05 which indicates its suitability as a host for VM05 based on a particular set of customized priority ratings and based on consolidation as the placement goal (as opposed to the default, load balancing). The command stores the rating information in $HostRating.

The last command displays the host rating stored in $HostRating to the user.

NOTE: Because the preceding example supplies a single host object to Get-VMHostRating, if the host is running Windows Server 2008 R2, or later, VMware, or XenServer, it will perform a direct validation of the running state of the virtual machine against the target host to ensure migration compatibility of the virtual machine.


PS C:\> $VM = Get-SCVirtualMachine -Name "VM05"PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost05.Contoso.com"PS C:\> $HostRating = Get-SCVMHostRating -VM $VM -VMHost $VMHost -CPUPriority 6 -DiskPriority 5 -MemoryPriority 4 -NetworkPriority 4 -PlacementGoal "Consolidate"PS C:\> $HostRating

6: Calculate host ratings for a new virtual machine based on a specific virtual machine template.

The first command gets the virtual machine template object named "VMTemplate01" and stores the object in the $VMTemplate variable.

The second command gets the host object named VMHost01 and stores the object in the $VMHost variable.

The third command returns the placement ratings for a new virtual machine if it were created by using VMTemplate01 and if it were to be placed on host VMHost01. The command stores the ratings in $HostRating.

The last command displays the host ratings stored in $HostRating to the user.

NOTE: The DiskSpaceGB parameter is required even though the template might already have a virtual hard disk with a specified amount of disk space. Requiring the DiskSpaceGB parameter ensures that a certain minumum amount of hard disk space is available on the host that can be used by the virtual machine. If the amount of space specified for the virtual hard disk in the template is larger than the size specified by using the DiskSpaceGB parameter, the larger of the two sizes is taken into consideration when computing the host ratings.

NOTE: Because the preceding example supplies a single host object to Get-VMHostRating, if the host is running Windows Server 2008 R2, or later, VMware, or XenServer, it will perform a direct validation of the running state of the virtual machine against the target host to ensure migration compatibility of the virtual machine.


PS C:\> $VMTemplate = Get-SCVMTemplate | where {$_.Name -eq "VMTemplate01"}PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01.Contoso.com"PS C:\> $HostRating = Get-SCVMHostRating -DiskSpaceGB 5 -VMTemplate $VMTemplate -VMHost $VMHost -VMName "VM06"PS C:\> $HostRating

7: Calculate host ratings for a specific host as a possible host for all virtual machines.

The first command gets the host object that named VMHost02 and stores the host object in the $VMHost variable.

The second command gets all virtual machines objects in your environment and saves these objects in the $VMs object array. If your environment has a very large number of virtual machines, you might want to use a filter to select a subset of virtual machines.

The third command returns the placement ratings for VMHost02 which indicate its suitability as a host for each of the virtual machine objects in $VMs and stores the rating information in $RatingArray. For more information about the Windows PowerShell foreach loop statement, type: Get-Help about_ForEach.

The last command displays the ratings stored in $RatingArray for the user.

NOTE: This example computes the ratings for each virtual machine individually on a host. If you want to place multiple virtual machines on a host, create a temporary hardware profile with the aggregated resource demands and pass it to Get-SCVMHostRating.

NOTE: Because the preceding example supplies a single host object to Get-VMHostRating, if the host is running Windows Server 2008 R2, or later, VMware, or XenServer, it will perform a direct validation of the running state of the virtual machine against the target host to ensure migration compatibility of the virtual machine.


PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost02.Contoso.com"PS C:\> $VMs = Get-SCVirtualMachinePS C:\> $RatingArray = @( ForEach ($VM in $VMs) {Get-VMHostRating -VM $VM -VMHost $VMHost} )PS C:\> $RatingArray

Related topics

 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft