## PowerCLI Reference

# Get-DrsVMHostRule

## Synopsis

This cmdlet retrieves VM to VMHost DRS rules that match the specified filters.

Syntax

Get-DrsVMHostRule [[-Name] <String[]>] [[-Cluster] <Cluster[]>] [-Type <DrsVMHostRuleType[]>] [-VMGroup <DrsClusterVMGroup[]>] [-VMHostGroup <DrsClusterVMHostGroup[]>] [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Online version
New-DrsVMHostRule
Remove-DrsVMHostRule
Set-DrsVMHostRule

Detailed Description

This cmdlet retrieves VM to VMHost DRS rules that match the specified filters.

Parameters

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Name | String[] | Specifies the names of the DRS rules you want to retrieve. | false | false
Cluster | Cluster[] | Specifies the DRS clusters from which you want to retrieve rules. | false | true (ByValue)
Server | VIServer[] | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | false | false
Type | DrsVMHostRuleType[] | Specifies the types of DRS rules you want to retrieve. This parameter accepts MustRunOn, ShouldRunOn, MustNotRunOn, and ShouldNotRunOn values. | false | false
VMGroup | DrsClusterVMGroup[] | Filters rules by VM group. | false | true (ByValue)
VMHostGroup | DrsClusterVMHostGroup[] | Filters rules by VMHost group. | false | true (ByValue)

Return Type

Zero or more DrsVMHostRule objects

Notes

Examples

-------------- Example 1 --------------

    Get-DrsVMHostRule -Type "MustRunOn"

Retrieves all VM to VMHost DRS rules, which are of type "MustRunOn".

-------------- Example 2 --------------

    $cluster = Get-Cluster "MyCluster"
    Get-DrsVMHostRule -VMHostGroup "MyDrsVMHostGroup" -Cluster $cluster

Retrieves all available VM to VMHost DRS which include the "MyDrsVMHostGroup" DRS VMHost group in the "MyCluster" cluster.

Copyright © VMware, Inc. All rights reserved.