A Rust crate for managing Windows users and groups using the Windows API in Rust.
Features
- Create, update, delete, and fetch local users
- Check if a user exists and change user passwords
- Add or remove users from local groups
- List local groups and group members
- List and count users with
UserFilterFlags
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage Examples
Creating and Managing a User
use ;
let username = "DemoUser";
// Create a new user
let user = builder
.name
.password
.full_name
.comment
.build;
// Add the user
match add_user
// Verify the user exists
match user_exists
let settings = builder
.comment
.full_name
.build;
// Update the user
match update_user
// Delete the user
match delete_user
Using Struct Methods
use ;
// Create a new user
let mut user = builder
.name
.password
.build;
// Add the user
match user.add
// Verify the user exists
match user.exists ;
let update = builder
.comment
.build;
// Update the user
match user.update
// Delete the user
match user.delete
Managing Group Membership
use ;
let username = ;
let group = "Users";
match add_users_to_group
match list_group_members
match remove_users_from_group
Listing Local Users
use ;
match count_users
match list_users
Requirements
- Windows 7 or later
- Administrative privileges for certain operations
Support
For issues and questions:
- Open an issue on GitHub
- Check the documentation
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.