heim-rs / heim

Cross-platform async library for system information fetching 🦀
https://heim-rs.github.io/
Apache License 2.0
902 stars 95 forks source link

List users available on a host #327

Open daladim opened 3 years ago

daladim commented 3 years ago

I'd like to list the users "available" on a system, and get their home dirs. This is not available on heim, since heim::host::users() only lists currently logged in users

I'm not sure yet what "available" means. Should we also list "special" users (SYSTEM, LOCAL_NETWORK, etc.) ? What should we list on a machine that is part of a Windows domain that has local and domain users?

I might try to implement something, but feel free to give your opinion on this first :-)

daladim commented 3 years ago

Hmm, NetUserEnum does not return the profile home dir (or rather, it does but it's an empty string, according to Manage this PC > Local Users and groups > Users > > double click > Profile tab > Home folder)...

daladim commented 3 years ago

It looks like using the WMI request SELECT * FROM Win32_UserProfile is a better choice