Group Resource
Synopsis
Manages local Windows groups, including creation, member management, and
removal. Supports both additive and exact member lists through the _purge
property.
Type
Capabilities
- Get
- Set
- Delete
- Export
Properties
groupName
The name of the local group.
description
A description of the group.
members
The group members.
_purge
When true, removes members not in the list. When false (default), only adds
members.
_exist
Whether the group should exist.
Member management patterns
Additive mode (default)
When _purge is false or omitted, the Set operation only adds the specified
members. Existing
members that aren't in the list are left unchanged.
If the group already has members charlie and dave, after Set the group
contains alice,
bob, charlie, and dave.
Exact mode
When _purge is true, the Set operation ensures only the specified members
are present. Members
not in the list are removed.
After Set, the group contains only alice and bob.
Note
This resource requires administrator privileges for all write operations.
Examples
Example 1 — Get a group
Example 2 — Create a group with members
Example 3 — Set exact membership
Example 4 — Delete a group
Example 5 — Configuration document
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Application operators group
type: OpenDsc.Windows/Group
properties:
groupName: AppOperators
description: Application operators
members:
- svc-app
_purge: true
Exit codes
| Code | Description |
|---|---|
| 0 | Success |
| 1 | Error |
| 2 | Invalid JSON |
| 3 | Access denied |
| 4 | Invalid argument |
| 5 | Unauthorized access |
| 6 | Group already exists |