INGROUP

Action

Checks whether the current user is a member of one or more groups.

 

Syntax

INGROUP ("group name" [<,> "group name 2"], Mode)

 

Parameter

Group name1, group name 2, group name …

Identifies the group(s) in which to check the user's membership. Multiple group names may be passed as arguments. Alternatively, you may specify a single, one-dimensional, array of which the element(s) are the names of one or more groups to test.

Mode

Optional integer parameter indicating whether or not Ingroup checks for groupmembership of one or all groups in the list (default = 0). Possible values:

 

0

Ingroup checks for membership of ONE of the groups in the list (default).

1

Ingroup checks for membership of ALL of the groups in the list.

 

Remarks

INGROUP can be used to check for group membership of groups that exist on the domain or server where the user is logged on, or to check for group membership of groups on a specific domain or server.

 

When checking for a local group, INGROUP identifies that the user is indirectly a member of the group by virtue of being a member of a global group which, in turn, is a member of the local group.

 

If you want to check for membership in a group on a specific domain or server, use the following format:

 

"OtherDomain\group"

 

Or

"\\SomeServer\group"

 

On Windows 9x clients, INGROUP works on local groups only if the KiXtart RPC service is running.

Returns

 

0

The user is not a member of any of the groups specified.

1

The user is a member of one or more groups.

Example

IF INGROUP("Domain Users")

    DISPLAY "z:\users.txt"

ENDIF

 

IF INGROUP("Developers", "Testers") = 1

    ? "Member of Developers OR Testers group"

ENDIF

 

IF INGROUP("Developers", "Testers", 1) = 1

    ? "Member of Developers AND Testers group"

ENDIF

 

$Array = "Developers", "Testers"

IF INGROUP($Array, 1) = 1

    ? "Member of Developers AND Testers group"

ENDIF

 

IF INGROUP("\\" + @WKSTA + "\Developers") = 1

    ? "Member of Developers on local system"

ENDIF