UniversalDsc.Resource.Windows.Group
0.1.1
dotnet tool install --global UniversalDsc.Resource.Windows.Group --version 0.1.1
dotnet new tool-manifest
dotnet tool install --local UniversalDsc.Resource.Windows.Group --version 0.1.1
#tool dotnet:?package=UniversalDsc.Resource.Windows.Group&version=0.1.1
nuke :add-package UniversalDsc.Resource.Windows.Group --version 0.1.1
UniversalDsc.Resource.Windows.Group
A Universal DSC Resource for managing Windows local groups. This resource provides management of Windows local groups through Microsoft Desired State Configuration (DSC) v3 or running the executable standalone.
Features
- Create, update, and delete local Windows groups
- Manage group properties: name, description, and membership
- Configure group membership: add specific members, include/exclude members
- Support for users and groups as members
- Full integration with DSC v3 framework
- Support for
get
,set
,test
,delete
, andexport
operations
Usage
Installation
dotnet tool install UniversalDsc.Resource.Windows.Group --global
dotnet tool install UniversalDsc.Resource.Windows.Group --tool-path mytools
Microsoft DSC v3 integration
The windows-group.exe
can be executed through Microsoft DSC v3. Using dotnet.exe tool install
doesn't automatically copy the windows-group.dsc.resource.json
to the root directory. If you manually copy the file in the root, the DSC engine can pick it up.
The following code snippet can be run after the tool is installed:
$rootPath = Join-Path $env:USERPROFILE -ChildPath '.dotnet' -AdditionalChildPath 'tools'
$storePath = Join-Path $rootPath -ChildPath '.store' -AdditionalChildPath 'universaldsc.resource.windows.group'
$manifestFile = Get-ChildItem -Path $storePath -Recurse -Filter *.dsc.resource.json | Select-Object -First 1
Copy-Item -Path $manifestFile -Destination $rootPath
Configuration document example
The following example shows you how you can run a configuration document through dsc.exe
:
# group.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: TestGroup
type: UniversalDsc.Windows/Group
properties:
groupName: testgroup
description: Test group for demonstration
members:
- Administrator
- testuser
- name: PowerUsersGroup
type: UniversalDsc.Windows/Group
properties:
groupName: PowerUsers
description: Power Users with specific membership
membersToInclude:
- Administrator
membersToExclude:
- Guest
Run the following command to execute dsc.exe
if you have it installed:
dsc config get --file group.dsc.config.yaml
Properties
- groupName (required): The name for the local group
- description (optional): Description for the group
- members (optional): Array of specific members that should be in the group (exact membership)
- membersToInclude (optional): Array of members to ensure are included in the group
- membersToExclude (optional): Array of members to ensure are excluded from the group
- exist (optional): Whether the group should exist (true/false, defaults to true)
Member management options
You can manage group membership in three ways:
- Exact membership (
members
): Specifies the exact list of members. Any existing members not in this list will be removed. - Additive membership (
membersToInclude
): Ensures specified members are added to the group without affecting other existing members. - Exclusive membership (
membersToExclude
): Ensures specified members are removed from the group without affecting other members.
members
cannot be used with membersToInclude
or membersToExclude
. However, membersToInclude
and membersToExclude
can be used together.
Examples
Create a group with specific members
windows-group.exe config set --input '{"groupName":"TestGroup","description":"Test group","members":["Administrator","testuser"]}'
Add members to an existing group
windows-group.exe config set --input '{"groupName":"PowerUsers","membersToInclude":["newuser"]}'
Remove specific members from a group
windows-group.exe config set --input '{"groupName":"PowerUsers","membersToExclude":["Guest"]}'
Check if a group exists and get its current state
windows-group.exe config get --input '{"groupName":"TestGroup"}'
Test if a group is in desired state
windows-group.exe config test --input '{"groupName":"TestGroup","members":["Administrator"]}'
Export all local groups
windows-group.exe config export
Additional information
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
Added icon to the package