|
| 1 | +--- |
| 2 | +description: Add-ClusterGroupToAffinityRule |
| 3 | +external help file: ClusterAffinityRule.cdxml-help.xml |
| 4 | +Module Name: FailoverClusters |
| 5 | +ms.date: 09/20/2023 |
| 6 | +online version: https://learn.microsoft.com/powershell/module/failoverclusters/add-clustergrouptoaffinityrule?view=windowsserver2022-ps&wt.mc_id=ps-gethelp |
| 7 | +schema: 2.0.0 |
| 8 | +title: Add-ClusterGroupToAffinityRule |
| 9 | +--- |
| 10 | + |
| 11 | +# Add-ClusterGroupToAffinityRule |
| 12 | + |
| 13 | +## SYNOPSIS |
| 14 | +Adds a cluster group to an affinity rule. |
| 15 | + |
| 16 | +## SYNTAX |
| 17 | + |
| 18 | +### Query (cdxml) (Default) |
| 19 | + |
| 20 | +``` |
| 21 | +Add-ClusterGroupToAffinityRule [[-Name] <String[]>] [-Groups] <String[]> |
| 22 | + [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-PassThru] [<CommonParameters>] |
| 23 | +``` |
| 24 | + |
| 25 | +### InputObject (cdxml) |
| 26 | + |
| 27 | +``` |
| 28 | +Add-ClusterGroupToAffinityRule -InputObject <CimInstance[]> [-Groups] <String[]> |
| 29 | +[-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-PassThru] [<CommonParameters>] |
| 30 | +``` |
| 31 | + |
| 32 | +## DESCRIPTION |
| 33 | + |
| 34 | +Adds a cluster group to a named affinity rule. |
| 35 | + |
| 36 | +## EXAMPLES |
| 37 | + |
| 38 | +### Example 1 - Add a group to an affinity rule |
| 39 | + |
| 40 | +```powershell |
| 41 | +Add-ClusterGroupToAffinityRule -Groups MyGroup -Name MyRule -Cluster MyCluster |
| 42 | +``` |
| 43 | + |
| 44 | +This example adds the group named `MyGroup` to the affinity rule named `MyRule` on the cluster named |
| 45 | +`MyCluster`. |
| 46 | + |
| 47 | +### Example 2 - Add a group to an affinity rule using pipeline |
| 48 | + |
| 49 | +```powershell |
| 50 | +Get-ClusterAffinityRule -name Rule1 | |
| 51 | + Add-ClusterGroupToAffinityRule -Groups MyGroup |
| 52 | +``` |
| 53 | + |
| 54 | +The command gets the affinity rule `Rule1` object and passes it to the |
| 55 | +`Add-ClusterGroupToAffinityRule` command. The command adds the cluster group `MyGroup` to the |
| 56 | +affinity rule. |
| 57 | + |
| 58 | +## PARAMETERS |
| 59 | + |
| 60 | +### -AsJob |
| 61 | + |
| 62 | +Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to |
| 63 | +complete. |
| 64 | + |
| 65 | +The cmdlet immediately returns an object that represents the job and then displays the command |
| 66 | +prompt. You can continue to work in the session while the job completes. To manage the job, use the |
| 67 | +`*-Job` cmdlets. To get the job results, use the |
| 68 | +[Receive-Job](https://go.microsoft.com/fwlink/?LinkID=113372) cmdlet. |
| 69 | + |
| 70 | +For more information about PowerShell background jobs, see |
| 71 | +[about_Jobs](https://go.microsoft.com/fwlink/?LinkID=113251). |
| 72 | + |
| 73 | +```yaml |
| 74 | +Type: SwitchParameter |
| 75 | +Parameter Sets: (All) |
| 76 | +Aliases: |
| 77 | + |
| 78 | +Required: False |
| 79 | +Position: Named |
| 80 | +Default value: None |
| 81 | +Accept pipeline input: False |
| 82 | +Accept wildcard characters: False |
| 83 | +``` |
| 84 | +
|
| 85 | +### -CimSession |
| 86 | +
|
| 87 | +Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session |
| 88 | +object, such as the output of a [New-CimSession](https://go.microsoft.com/fwlink/p/?LinkId=227967) |
| 89 | +or [Get-CimSession](https://go.microsoft.com/fwlink/p/?LinkId=227966) cmdlet. The default is the |
| 90 | +current session on the local computer. |
| 91 | +
|
| 92 | +```yaml |
| 93 | +Type: CimSession[] |
| 94 | +Parameter Sets: (All) |
| 95 | +Aliases: Session |
| 96 | + |
| 97 | +Required: False |
| 98 | +Position: Named |
| 99 | +Default value: None |
| 100 | +Accept pipeline input: False |
| 101 | +Accept wildcard characters: False |
| 102 | +``` |
| 103 | +
|
| 104 | +### -Groups |
| 105 | +
|
| 106 | +This list of groups to be added to the affinity rule. |
| 107 | +
|
| 108 | +```yaml |
| 109 | +Type: String[] |
| 110 | +Parameter Sets: (All) |
| 111 | +Aliases: |
| 112 | + |
| 113 | +Required: True |
| 114 | +Position: 1 |
| 115 | +Default value: None |
| 116 | +Accept pipeline input: False |
| 117 | +Accept wildcard characters: False |
| 118 | +``` |
| 119 | +
|
| 120 | +### -InputObject |
| 121 | +
|
| 122 | +Specifies the affinity rule object that is used in a pipeline command. |
| 123 | +
|
| 124 | +```yaml |
| 125 | +Type: CimInstance[] |
| 126 | +Parameter Sets: InputObject (cdxml) |
| 127 | +Aliases: |
| 128 | + |
| 129 | +Required: True |
| 130 | +Position: Named |
| 131 | +Default value: None |
| 132 | +Accept pipeline input: True (ByValue) |
| 133 | +Accept wildcard characters: False |
| 134 | +``` |
| 135 | +
|
| 136 | +### -Name |
| 137 | +
|
| 138 | +The Affinity rule to add the groups to. |
| 139 | +
|
| 140 | +```yaml |
| 141 | +Type: String[] |
| 142 | +Parameter Sets: Query (cdxml) |
| 143 | +Aliases: |
| 144 | + |
| 145 | +Required: False |
| 146 | +Position: 0 |
| 147 | +Default value: None |
| 148 | +Accept pipeline input: True (ByPropertyName) |
| 149 | +Accept wildcard characters: False |
| 150 | +``` |
| 151 | +
|
| 152 | +### -PassThru |
| 153 | +
|
| 154 | +Returns the original affinity rule object passed to the command. By default, this cmdlet doesn't |
| 155 | +generate any output. |
| 156 | +
|
| 157 | +```yaml |
| 158 | +Type: SwitchParameter |
| 159 | +Parameter Sets: (All) |
| 160 | +Aliases: |
| 161 | + |
| 162 | +Required: False |
| 163 | +Position: Named |
| 164 | +Default value: None |
| 165 | +Accept pipeline input: False |
| 166 | +Accept wildcard characters: False |
| 167 | +``` |
| 168 | +
|
| 169 | +### -ThrottleLimit |
| 170 | +
|
| 171 | +Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If |
| 172 | +this parameter is omitted or a value of `0` is entered, then PowerShell calculates an |
| 173 | +optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the |
| 174 | +computer. The throttle limit applies only to the current cmdlet, not to the session or to the |
| 175 | +computer. |
| 176 | + |
| 177 | +```yaml |
| 178 | +Type: Int32 |
| 179 | +Parameter Sets: (All) |
| 180 | +Aliases: |
| 181 | +
|
| 182 | +Required: False |
| 183 | +Position: Named |
| 184 | +Default value: None |
| 185 | +Accept pipeline input: False |
| 186 | +Accept wildcard characters: False |
| 187 | +``` |
| 188 | + |
| 189 | +### CommonParameters |
| 190 | + |
| 191 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, |
| 192 | +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, |
| 193 | +-WarningAction, and -WarningVariable. For more information, see |
| 194 | +[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). |
| 195 | + |
| 196 | +## INPUTS |
| 197 | + |
| 198 | +### System.String[] |
| 199 | + |
| 200 | +When a string is piped to this cmdlet, the value is used as the name of the affinity rule to add the |
| 201 | +cluster shared volume to. |
| 202 | + |
| 203 | +### Microsoft.Management.Infrastructure.CimInstance[] |
| 204 | + |
| 205 | +This cmdlet accepts CIM instance objects representing an affinity rule like those returned by the |
| 206 | +[Get-ClusterAffinityRule](Get-ClusterAffinityRule.md) cmdlet. |
| 207 | + |
| 208 | +## OUTPUTS |
| 209 | + |
| 210 | +### None |
| 211 | + |
| 212 | +By default, the cmdlet doesn't return any output. |
| 213 | + |
| 214 | +### Microsoft.Management.Infrastructure.CimInstance |
| 215 | + |
| 216 | +### Microsoft.Management.Infrastructure.CimInstance#root/MSCLUSTER/MSCluster_AffinityRule |
| 217 | + |
| 218 | +When the **PassThru** parameter is specified, the cmdlet returns an object representing an affinity |
| 219 | +rule as a CIM instance within the `root/MSCLUSTER/MSCluster_AffinityRule` path. |
| 220 | + |
| 221 | +## NOTES |
| 222 | + |
| 223 | +## RELATED LINKS |
| 224 | + |
| 225 | +[Remove-ClusterGroupFromAffinityRule](Remove-ClusterGroupFromAffinityRule.md) |
0 commit comments