getusers

Table of Contents

Prototype: getusers(exclude_names, exclude_ids)

Return type: slist

Description: Returns a list of all users defined, except those names in exclude_names and uids in exclude_ids

Arguments:

  • exclude_names: string, in the range: .*
  • exclude_ids: string, in the range: .*

Example:

body common control
{
      bundlesequence => { "example" };
}

bundle agent example
{
  vars:
      "allusers" slist => getusers("","");
      "root_list" slist => { "root" };
      # this will get just the root users out of the full user list
      "justroot" slist => intersection(allusers, root_list);

  reports:
      "Found just the root user: $(justroot)";
}

Output:

R: Found just the root user: root

Notes: This function is currently only available on Unix-like systems.

History: Was introduced in version 3.1.0b1,Nova 2.0.0b1 (2010).

See also: getuserinfo(), users.