Share via


Add-SCCustomPlacementRule

Adds a custom placement rule to the placement configuration for a host group.

Syntax

ShouldMatch

Add-SCCustomPlacementRule
    -PlacementConfiguration <PlacementConfigurationSettings>
    -CustomPropertyName <String>
    [-ShouldMatch]
    [-VMMServer <ServerConnection>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ShouldNotMatch

Add-SCCustomPlacementRule
    -PlacementConfiguration <PlacementConfigurationSettings>
    -CustomPropertyName <String>
    [-ShouldNotMatch]
    [-VMMServer <ServerConnection>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

MustMatch

Add-SCCustomPlacementRule
    -PlacementConfiguration <PlacementConfigurationSettings>
    -CustomPropertyName <String>
    [-MustMatch]
    [-VMMServer <ServerConnection>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

MustNotMatch

Add-SCCustomPlacementRule
    -PlacementConfiguration <PlacementConfigurationSettings>
    -CustomPropertyName <String>
    [-MustNotMatch]
    [-VMMServer <ServerConnection>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Add-SCCustomPlacementRule cmdlet adds a custom placement rule to the placement configuration for a host group.

Examples

Example 1: Add a new custom placement rule to a placement configuration for a host group

PS C:\> $HostGroup = Get-SCVMHostGroup "HostGroup01"
PS C:\> $PlacementConfig = Get-SCPlacementConfiguration -VMHostGroup $HostGroup
PS C:\> $CustomProp = Get-SCCustomProperty -Name "Cost Center"
PS C:\> Add-SCCustomPlacementRule -PlacementConfiguration $PlacementConfig -MustMatch -CustomProperty $CustomProp

The first command gets the host group object named HostGroup01 and stores the object in the $HostGroup variable.

The second command gets the placement configuration object for the host group stored in $HostGroup and places the object in the $PlacementConfig variable.

The third command gets the custom property object named Cost Center and stores the object in the $CustomProp variable.

The last command adds a custom placement rule to the placement configuration stored in $PlacementConfig.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CustomPropertyName

Specifies the name for a custom property.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MustMatch

Indicates that the property value of the virtual machine must match the host.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MustMatch
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MustNotMatch

Indicates that the property value of the virtual machine must not match the host.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

MustNotMatch
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PlacementConfiguration

Specifies a placement configuration object.

Parameter properties

Type:PlacementConfigurationSettings
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ShouldMatch

Indicates that the property value of the virtual machine should match the host.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ShouldMatch
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ShouldNotMatch

Indicates that the property value of the virtual machine should not match the host.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ShouldNotMatch
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VMMServer

Specifies a VMM server object.

Parameter properties

Type:ServerConnection
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

CustomPlacementRule

This cmdlet returns a CustomPlacementRule object.