Add-SCCustomPlacementRule
将自定义放置规则添加到主机组的放置配置。
语法
Add-SCCustomPlacementRule
-PlacementConfiguration <PlacementConfigurationSettings>
-CustomPropertyName <String>
[-ShouldMatch]
[-VMMServer <ServerConnection>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Add-SCCustomPlacementRule
-PlacementConfiguration <PlacementConfigurationSettings>
-CustomPropertyName <String>
[-ShouldNotMatch]
[-VMMServer <ServerConnection>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Add-SCCustomPlacementRule
-PlacementConfiguration <PlacementConfigurationSettings>
-CustomPropertyName <String>
[-MustMatch]
[-VMMServer <ServerConnection>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Add-SCCustomPlacementRule
-PlacementConfiguration <PlacementConfigurationSettings>
-CustomPropertyName <String>
[-MustNotMatch]
[-VMMServer <ServerConnection>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Add-SCCustomPlacementRule cmdlet 向主机组的放置配置添加自定义放置规则。
示例
示例 1:向主机组的放置配置添加新的自定义放置规则
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
第一个命令获取名为 HostGroup01 的主机组对象,并将该对象存储在$HostGroup变量中。
第二个命令获取存储在$HostGroup中的主机组的放置配置对象,并将该对象置于$PlacementConfig变量中。
第三个命令获取名为 Cost Center 的自定义属性对象,并将对象存储在$CustomProp变量中。
最后一个命令将自定义放置规则添加到存储在$PlacementConfig中的放置配置。
参数
-Confirm
提示你在运行 cmdlet 之前进行确认。
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CustomPropertyName
指定自定义属性的名称。
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-JobVariable
指定跟踪作业进度,并将其存储在此参数命名的变量中。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MustMatch
指示虚拟机的属性值必须与主机匹配。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MustNotMatch
指示虚拟机的属性值必须与主机不匹配。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PlacementConfiguration
指定放置配置对象。
Type: | PlacementConfigurationSettings |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PROTipID
指定触发此操作 (PRO 提示) 的性能和资源优化提示的 ID。 此参数允许审核 PRO 提示。
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RunAsynchronously
指示作业以异步方式运行,以便控件立即返回到命令 shell。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ShouldMatch
指示虚拟机的属性值应与主机匹配。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ShouldNotMatch
指示虚拟机的属性值不应与主机匹配。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VMMServer
指定VMM 服务器对象。
Type: | ServerConnection |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
显示在此 cmdlet 运行的情况下将会发生什么。 此 cmdlet 未运行。
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
输出
CustomPlacementRule
此 cmdlet 返回 CustomPlacementRule 对象。