getOSUserInfo()

Returns the attributes for a user "userName".

Synopsis

mapping getOSUserInfo( string userName, [ string domain]);

Parameters

Parameter Description
userName

The user name.

For a nonexistent user an error message is returned.

domain

The parameter "domain" specifies in which domain the query is executed. The default value is the domain of the current computer (where the query is executed). If only one domain exists in the IT infrastructure, the parameter does not bear a meaning. If the IT infrastructure consists of several domains and a user was created in another domain than where the query is executed, the attributes for the user are not found. In this case, specify the correct domain by using the parameter "domain".

Example:

  • The user belongs to the domain "Domain1" and the computer used to execute the query was logged on in the same domain -> the attributes for the user are found.

  • The computer is logged on in another domain than "Domain1", the attributes for the user are not found or if a user with the same name exists in this other domain, the attributes for the wrong user are found.

Return value

The attributes for the user "userName".

Description

Returns the attributes for the user "userName". The attributes are saved in a mapping with the following keys:

"PrimaryGroupOSID": The OS ID of the primary user group.

"Comment": Description of the user. Under Linux the "GECOS" entry form the password file is split into "Fullname,Comment". If no "," is available the "Comment" entry will be empty.

"Name" : Name of the user (Account name).

"Disabled": If the parameter "Disabled" is TRUE, the account is disabled and login is not possible.

"PrimaryGroupName": Name of the primary user group.

"OSID": Operating system ID.

"OSID" may return another value for Unix systems than for Windows systems in an ActiveDirectory environment since Unix (for example, Samba) maps the Windows specific ID (SID) into a Unix specific ID (unsigned).

"FullName": Whole name of the user (Display name).

Example

The following example returns the attributes for the user "MDavis".

main()
{
  mapping m;
  m = getOSUserInfo("MDavis");
  DebugN("User info of the user MDavis", m);
}

Assignment

User administration

Availability

CTRL