Carbon_Group

DSC resource for configuring local Windows groups.

Syntax

Carbon_Group [String] #ResourceName
{
    Name = [string]
    [DependsOn = [string[]]]
    [Description = [string]]
    [Ensure = [string]{ Absent | Present }]
    [Members = [string[]]]
    [PsDscRunAsCredential = [PSCredential]]
}

Description

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.

Related Commands

Parameters

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 Ensure is Present).

false false
Ensure String

Should be either Present or Absent. If set to Present, a group is configured and membership configured. If set to Absent, the group is removed.

false false
Members String[]

The group's members. Only used when adding/updating a group (i.e. when Ensure is Present).

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.

EXAMPLE 1

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' );
}

EXAMPLE 2

Demonstrates how to uninstall a group.

Carbon_Group 'RemoveRepublic
{
    Name = 'Republic';
    Ensure = 'Absent';
}