Set-CMOrchestrationGroup
Configure an orchestration group.
Syntax
Set-CMOrchestrationGroup
[-InputObject] <IResultObject>
[-NewName <String>]
[-Description <String>]
[-OrchestrationType <OrchestrationTypeValue>]
[-OrchestrationValue <Int32>]
[-OrchestrationTimeOutMin <Int32>]
[-MaxLockTimeOutMin <Int32>]
[-PreScript <String>]
[-PreScriptTimeoutSec <Int32>]
[-PostScript <String>]
[-PostScriptTimeoutSec <Int32>]
[-MemberResourceIds <Int32[]>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-CMOrchestrationGroup
[-Id] <Int32>
[-NewName <String>]
[-Description <String>]
[-OrchestrationType <OrchestrationTypeValue>]
[-OrchestrationValue <Int32>]
[-OrchestrationTimeOutMin <Int32>]
[-MaxLockTimeOutMin <Int32>]
[-PreScript <String>]
[-PreScriptTimeoutSec <Int32>]
[-PostScript <String>]
[-PostScriptTimeoutSec <Int32>]
[-MemberResourceIds <Int32[]>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-CMOrchestrationGroup
[-Name] <String>
[-NewName <String>]
[-Description <String>]
[-OrchestrationType <OrchestrationTypeValue>]
[-OrchestrationValue <Int32>]
[-OrchestrationTimeOutMin <Int32>]
[-MaxLockTimeOutMin <Int32>]
[-PreScript <String>]
[-PreScriptTimeoutSec <Int32>]
[-PostScript <String>]
[-PostScriptTimeoutSec <Int32>]
[-MemberResourceIds <Int32[]>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Use this cmdlet to configure an orchestration group.
Use orchestration groups to better control the deployment of software updates to devices. You may need to carefully manage updates for specific workloads, or automate behaviors in between. For more information, see Create and use orchestration groups in Configuration Manager.
Note
Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>
. For more information, see getting started.
Examples
Example 1: Change the type and specify the sequence
This example first uses the Get-CMOrchestrationGroup cmdlet to get an object for the orchestration group named IT servers. It stores this object in the og variable.
The next command defines an array named devices. It loops through each member of the IT servers orchestration group ($og.MOGMembers
), and passes the member's ID to the Get-CMDevice cmdlet. The returned device object is appended to the devices array.
The next command sorts the array by device name, and returns the device resource IDs into the sortedIDs variable.
It then splats the cmdlet parameters into the parameters variable. It's not required to splat the parameters, it just makes it easier to read the parameters for such a long command line.
The last command configures the specified orchestration group with a defined order of sequence. It's using the MemberResourceIds parameter to set the sequence, not add or remove members.
$og = Get-CMOrchestrationGroup -Name "IT servers"
$devices = @()
foreach ( $id in $og.MOGMembers ) {
$devices += Get-CMDevice -Id $id -Fast
}
$sortedIDs = ( $devices | Sort-Object -Property Name | Select-Object ResourceId ).ResourceId
$parameters = @{
InputObject = $og
Description = "Change type and sequence"
OrchestrationType = "Sequence"
MemberResourceIds = $sortedIDs
}
Set-CMOrchestrationGroup @parameters
This example shows how to do a programmatic sort of the existing members. If the membership of the orchestration group doesn't change, it uses the following general process:
- Use the existing member resource IDs.
- Get more information about each resource.
- Sort the list on that information.
- Return the resource IDs for the newly sorted list.
This example uses Get-CMDevice to get more information, but you can replace it with any cmdlet that uses the device resource ID as an input. You can also replace the sorting mechanism with another function.
Example 2: Get script content from a file
This example uses the built-in Get-Content cmdlet to read the script text from a local file. It stores the script text in the postScript variable. The second command configures the orchestration group with the new post-script.
$postScript - Get-Content -Path "D:\Scripts\OG\Post1.ps1"
Set-CMOrchestrationGroup -InputObject $og -PostScript $postScript
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Description
Specify an optional description for the orchestration group to help identify it.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisableWildcardHandling
This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ForceWildcardHandling
This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Id
Specify the ID of orchestration group to configure. This value is the MOGID property, which is an integer. For example, 16777217
.
Type: | Int32 |
Aliases: | MOGID |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
Specify an object for the orchestration group to configure. To get this object, use the Get-CMOrchestrationGroup cmdlet.
Type: | IResultObject |
Aliases: | OrchestrationGroup |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-MaxLockTimeOutMin
Specify an integer value for the orchestration group member timeout in minutes. This value is the time limit for a single device in the group to install the updates.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MemberResourceIds
Specify an array of resource IDs for the devices to add as members of this orchestration group. The resource ID is an integer, for example, 16777220
. It's the ResourceId property on a device or resource object. To get a device object, use the Get-CMDevice or Get-CMResource cmdlets.
When you set the OrchestrationType parameter to Sequence
, use this parameter to determine the order.
Type: | Int32[] |
Aliases: | MogMembers |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
Specify the name of the orchestration group to configure.
Type: | String |
Aliases: | OrchestrationGroupName |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NewName
Specify a new name for this orchestration group. Use this parameter to rename the orchestration group.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OrchestrationTimeOutMin
Specify an integer value for the orchestration group timeout in minutes. This value is the time limit for all group members to install the updates.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OrchestrationType
Specify one of the following values for the type of orchestration group:
Number
: Allow a number of the devices to update at the same time. Use this setting to always limit to a specific number of devices, whatever the overall size of the orchestration group. To specify the number of devices, use the OrchestrationValue parameter.Percentage
: Allow a percentage of the devices to update at the same time. Use this setting to allow for future flexibility of the size of the orchestration group. To specify the percentage, use the OrchestrationValue parameter.Sequence
: Explicitly define the order in which devices run the software update deployment. The order is determined by the sort of the device resource IDs in the MemberResourceIds parameter.
Type: | OrchestrationTypeValue |
Accepted values: | Number, Percentage, Sequence |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OrchestrationValue
Specify an integer for the number or percentage of devices to update at the same time. Use this parameter when you set the OrchestrationType parameter to Number
or Percentage
.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PostScript
Specify the PowerShell script to run on each device after the deployment runs and the device restarts, if required.
This string value is the text of the script itself. If you have a script in a file that you want to use, first read it into a variable. For example, use the built-in Get-Content cmdlet.
The scripts should return a value of 0
for success. Any non-zero value is considered a script failure. You can't use a script with parameters. The maximum script length is 50,000 characters.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PostScriptTimeoutSec
Specify the integer value for the allowed time in seconds for the post-script to run before it times out.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PreScript
Specify the PowerShell script to run on each device before the deployment runs.
This string value is the text of the script itself. If you have a script in a file that you want to use, first read it into a variable. For example, use the built-in Get-Content cmdlet.
The scripts should return a value of 0
for success. Any non-zero value is considered a script failure. You can't use a script with parameters. The maximum script length is 50,000 characters.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PreScriptTimeoutSec
Specify the integer value for the allowed time in seconds for the pre-script to run before it times out.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
Outputs
IResultObject
Notes
This cmdlet returns an object for the SMS_MachineOrchestrationGroup WMI class.