Skip to content
Daniel Berger edited this page Sep 26, 2021 · 9 revisions

Description

The sys-admin library is a unified, cross platform replacement for the Etc module.

Installation

gem install sys-admin

Synopsis

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

Available Methods

  • Admin.get_login
  • Admin.get_user
  • Admin.get_group
  • Admin.groups
  • Admin.users

Windows

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)

Darwin

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)
Clone this wiki locally