Set-SCCustomPlacementRule

Modifes a custom placement rule in the placement configuration of a host group.

Syntax

Set-SCCustomPlacementRule [-Confirm] -CustomPlacementRule <CustomPlacementRule> [-JobVariable <String>]
 [-MustMatch] [-PROTipID <Guid>] [-RunAsynchronously] [-VMMServer <ServerConnection>] [-WhatIf]
 [<CommonParameters>]
Set-SCCustomPlacementRule [-Confirm] -CustomPlacementRule <CustomPlacementRule> [-JobVariable <String>]
 [-MustNotMatch] [-PROTipID <Guid>] [-RunAsynchronously] [-VMMServer <ServerConnection>] [-WhatIf]
 [<CommonParameters>]
Set-SCCustomPlacementRule [-Confirm] -CustomPlacementRule <CustomPlacementRule> [-JobVariable <String>]
 [-PROTipID <Guid>] [-RunAsynchronously] [-ShouldMatch] [-VMMServer <ServerConnection>] [-WhatIf]
 [<CommonParameters>]
Set-SCCustomPlacementRule [-Confirm] -CustomPlacementRule <CustomPlacementRule> [-JobVariable <String>]
 [-PROTipID <Guid>] [-RunAsynchronously] [-ShouldNotMatch] [-VMMServer <ServerConnection>] [-WhatIf]
 [<CommonParameters>]

Description

The Set-SCCustomPlacementRule cmdlet modifies an existing custom placement rule in the placement configuration for a host group.

Examples

Example 1: Modify an existing custom placement rule in the placement configuration for a host group

PS C:\> $HostGroup = Get-SCVMHostGroup "HostGroup01"
PS C:\> $PlacementConfig = Get-SCPlacementConfiguration -VMHostGroup $HostGroup
PS C:\> $CPRule = Get-SCCustomPlacementRule -PlacementConfiguration $PlacementConfig | where {$_.CustomPropertyName -eq "Charge Code"}
PS C:\> Set-SCCustomPlacementRule -MustMatch -CustomPlacementRule $CPRule

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 placement rule object named Charge Code and stores the object in the $CPRule variable.

The last command modifes the custom placement rule for custom property Charge Code to be a Must Match rule.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-CustomPlacementRule

Specifies a custom placement rule object.

Type:CustomPlacementRule
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-JobVariable

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

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MustMatch

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

Type:SwitchParameter
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MustNotMatch

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

Type:SwitchParameter
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters: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.

Type:Guid
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RunAsynchronously

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

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ShouldMatch

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

Type:SwitchParameter
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ShouldNotMatch

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

Type:SwitchParameter
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VMMServer

Specifies a VMM server object.

Type:ServerConnection
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

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

Type:SwitchParameter
Aliases:wi
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False