-
-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Daniel Berger edited this page Sep 26, 2021
·
9 revisions
The sys-admin library is a unified, cross platform replacement for the Etc
module.
gem install sys-admin
require 'sys/admin' # or sys-admin
include Sys
# Returns an Array of User objects
a = Admin.users
# Returns an Array of Group objects
g = Admin.groups
# Get information about a particular user
p Admin.get_user("nobody")
p Admin.get_user("nobody", :localaccount => true) # Windows
# Get information about a particular group
p Admin.get_group("adm")
p Admin.get_group("adm", :localaccount => true) # Windows
- Admin.get_login
- Admin.get_user
- Admin.get_group
- Admin.groups
- Admin.users
The Windows versions of each method accept additional arguments that are essentially just properties that are forwarded to the underly WQL query as a way to limit the results.
Admin.get_user("nobody", :localaccount => true)
The Sys::Admin.users
and Sys::Admin.get_user
methods accept a :lastlog
key option. Set this to false if you want to eliminate lastlog information and significantly speed up the method.
Sys::Admin.get_user('joe', :lastlog => false)
Sys::Admin.users(:lastlog => false)