User
A Windows local user, identified by immutable SID.
The SID is what makes this a durable handle: the account may be renamed, by this API or another, and the handle keeps working.
Obtained from user or
create_user.
Fields
sid @ security.windows.SidThe account's SID.
Methods
delete()
Deletes the account.
grant_right name
Grants an account right.
Parameters
| Name | Type | Description |
|---|---|---|
name |
Str |
Right name, such as "SeServiceLogonRight". |
info() -> UserInfo
Reads a fresh snapshot of the account.
revoke_right name
Revokes an account right.
Revoking a right the account 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.
Returns
Right names, such as ["SeServiceLogonRight"].
update … -> UserInfo
Updates account state.
Omitted options leave the current value unchanged; nil clears a nullable
field and removes the account expiration. A password cannot be cleared with
nil.
Every other attribute is applied before name, so a failed rename leaves
the earlier changes applied and a failure before the rename means no rename
happens. A successful rename keeps this handle usable.
Parameters
| Name | Type | Description |
|---|---|---|
:name? |
Str |
New account name. Applied after every other option. |
:password? |
Str |
Password to set. |
:full_name? |
Str |
Display name. |
:comment? |
Str |
Administrative account comment. |
:user_comment? |
Str |
User-facing account comment. |
:home_dir? |
fs.Path |
Home directory. |
:home_dir_drive? |
Str |
Drive designator assigned to the home directory
at logon, such as "Z:". |
:profile? |
fs.Path |
Profile path. |
:script_path? |
fs.Path |
Logon script path. |
:account_expires? |
(time.DateTime | nil) |
Expiration instant. nil means
the account never expires. |
:disabled? |
Bool |
Whether the account is disabled. |
:password_never_expires? |
Bool |
Whether the password is exempt from expiry. |
:password_cannot_change? |
Bool |
Whether the user may change the password. |
Returns
Fresh information for the account.