Group
A Windows local group, identified by immutable SID.
As with User, the SID is what makes the handle durable across
a rename.
Obtained from group or
create_group.
Fields
sid @ security.windows.SidThe group's SID.
Methods
add_member principal
Adds a member to the group.
Parameters
| Name | Type | Description |
|---|---|---|
principal |
(Str | security.windows.Sid) |
Account name or SID. |
Errors
| Exception | Condition |
|---|---|
sys.AlreadyExistsError |
The principal is already a member |
delete()
Deletes the group.
grant_right name
Grants an account right.
Parameters
| Name | Type | Description |
|---|---|---|
name |
Str |
Right name, such as "SeServiceLogonRight". |
info() -> GroupInfo
Reads a fresh snapshot of the group.
members() -> Iter[security.windows.SidName]
Lists the group's members.
Returns
An Iter yielding
security.windows.SidNames.
remove_member principal
Removes a member from the group.
Parameters
| Name | Type | Description |
|---|---|---|
principal |
(Str | security.windows.Sid) |
Account name or SID. |
Errors
| Exception | Condition |
|---|---|
sys.NotFoundError |
The principal is not a member |
revoke_right name
Revokes an account right.
Revoking a right the group does not hold does nothing.
Parameters
| Name | Type | Description |
|---|---|---|
name |
Str |
Right name. |
rights() -> Array[Str]
Lists the account rights assigned through the local security policy.
update … -> GroupInfo
Updates the group.
The comment is applied before the rename, so a failed rename leaves the comment change applied.
Parameters
| Name | Type | Description |
|---|---|---|
:name? |
Str |
New group name. |
:comment? |
(Str | nil) |
Administrative comment. nil clears it. |
Returns
Fresh information for the group.