DSC resource for configuring local Windows groups.
Carbon_Group [String] #ResourceName
{
Name = [string]
[DependsOn = [string[]]]
[Description = [string]]
[Ensure = [string]{ Absent | Present }]
[Members = [string[]]]
[PsDscRunAsCredential = [PSCredential]]
}
The Carbon_Group
resource installs and uninstalls groups. It also adds members to existing groups.
The group is installed when Ensure
is set to Present
. Members of the group are updated to match the Members
property (i.e. members not listed in the Members
property are removed from the group). If Members
has no value, all members are removed. Because DSC resources run under the LCM which runs as System
, local system accounts must have access to the directories where both new and existing member accounts can be found.
The group is removed when Ensure
is set to Absent
. When removing a group, the Members
property is ignored.
The Carbon_Group
resource was added in Carbon 2.1.0.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Name | String | The name of the group. |
true | false | |
Description | String | A description of the group. Only used when adding/updating a group (i.e. when |
false | false | |
Ensure | String | Should be either |
false | false | |
Members | String[] | The group's members. Only used when adding/updating a group (i.e. when Members not in this list are removed from the group. |
false | false | @() |
WhatIf | SwitchParameter | false | false | ||
Confirm | SwitchParameter | false | false | ||
CommonParameters | This cmdlet supports common parameters. For more information type Get-Help about_CommonParameters . |
Demonstrates how to install a group and add members to it.
Carbon_Group 'CreateFirstOrder'
{
Name = 'FirstOrder';
Description = 'On to victory!';
Ensure = 'Present';
Members = @( 'FO\SupremeLeaderSnope', 'FO\KRen' );
}
Demonstrates how to uninstall a group.
Carbon_Group 'RemoveRepublic
{
Name = 'Republic';
Ensure = 'Absent';
}