The Win32 Network Management APIs 4

 

 

 

 

 

Get Functions

 

The network management get functions retrieve information about a domain. You can also call these functions to retrieve information about local, global, workstation, and server user accounts. The network management get functions are listed following.

 

Function

Description

NetGetAnyDCName()

Returns the name of any domain controller for a domain that is directly trusted by a specified server.

NetGetDCName()

Returns the name of the primary domain controller (PDC) for the specified domain.

NetGetDisplayInformationIndex()

Returns the index of the first display information entry whose name begins with a specified string or alphabetically follows the string.

NetQueryDisplayInformation()

Returns user, computer, or global group account information.

 

The information returned by the NetQueryDisplayInformation() function is available at the following levels:

 

  1. NET_DISPLAY_GROUP
  2. NET_DISPLAY_MACHINE
  3. NET_DISPLAY_USER

 

Group Functions

 

A global group contains user accounts from one domain that are grouped together under one group account name. A global group can contain only members (users) from the domain where the global group is created; it cannot contain local groups. A global group is available within its own domain and within any trusting domain. The network management group functions control global groups. The group functions are listed following.

 

Function

Description

NetGroupAdd()

Creates a global group.

NetGroupAddUser()

Adds one user to an existing global group.

NetGroupDel()

Removes a global group whether or not the group has any members.

NetGroupDelUser()

Removes one user name from a global group.

NetGroupEnum()

Lists all global groups on a server.

NetGroupGetInfo()

Returns information about a particular global group.

NetGroupGetUsers()

Lists all members of a particular global group.

NetGroupSetInfo()

Sets general information about a global group.

NetGroupSetUsers()

Assigns members to a new global group; replaces the members of an existing group.

 

When you call the NetGroupAdd() function to create a global group, you must supply a group name. Initially, a new group has no members. User accounts automatically belong to the special global group Domain Users. Membership in this group is indirectly controlled by the NetUserAdd(), NetUserDel(), and NetUserSetInfo() functions. Global group account information is available at the following levels:

 

  1. GROUP_INFO_0
  2. GROUP_INFO_1
  3. GROUP_INFO_2
  4. GROUP_INFO_3
  5. GROUP_INFO_1002
  6. GROUP_INFO_1005

 

The 1002 and 1005 levels are valid only for the NetGroupSetInfo() function. Global group member information is available at the following information level: GROUP_USERS_INFO_0. If you are programming for Active Directory, you may be able to call certain Active Directory Service Interface (ADSI) methods to achieve the same functionality you can achieve by calling the network management group functions.

 

Local Group Functions

 

A local group can contain user accounts or global group accounts from one or more domains. (Global groups can contain users from only one domain.) A local group shares common privileges and rights only within its own domain. The network management local group functions control members of local groups in a way that the functions can only be called locally on the system on which the local group is defined. On a workstation, or on a server that is not a domain controller, you can use only a local group defined on that system. In Active Directory, domains that are in native mode, local groups are called domain local groups. Domain local groups are available on all domain controllers, member servers, and workstations joined to the domain. Active Directory mixed-mode domains are defined on the primary domain controller and replicated to all other domain controllers in the domain. Therefore, a local group is available on all domain controllers within the domain in which it was created. The local group functions create or delete local groups, and review or adjust the memberships of local groups. These functions are listed following.

 

Function

Description

NetLocalGroupAdd()

Creates a local group.

NetLocalGroupAddMembers()

Adds one or more users or global groups to an existing local group.

NetLocalGroupDel()

Deletes a local group, removing all existing members from the group.

NetLocalGroupDelMembers()

Removes one or more members from an existing local group.

NetLocalGroupEnum()

Returns information about each local group account on a server.

NetLocalGroupGetInfo()

Returns information about a particular local group account on a server.

NetLocalGroupGetMembers()

Lists all members of a specified local group.

NetLocalGroupSetInfo()

Sets general information about a local group.

NetLocalGroupSetMembers()

Assigns members to a local group.

 

You can add a member to a local group by specifying the security identifier (SID) of the member. To translate a member account name to a SID, call the LookupAccountName() function. When you create a local group by calling the NetLocalGroupAdd() function, you must supply a local group name. Initially, the local group has no members. Local group account information is available at the following levels:

 

  1. LOCALGROUP_INFO_0
  2. LOCALGROUP_INFO_1

 

Local group membership information is available at the following information levels:

 

  1. LOCALGROUP_MEMBERS_INFO_0
  2. LOCALGROUP_MEMBERS_INFO_1
  3. LOCALGROUP_MEMBERS_INFO_2
  4. LOCALGROUP_MEMBERS_INFO_3

 

You can retrieve the names of the local groups to which a user belongs by calling the NetUserGetLocalGroups() function, specifying the following information level: LOCALGROUP_USERS_INFO_0. If you are programming for Active Directory, you may be able to call certain Active Directory Service Interface (ADSI) methods to achieve the same functionality you can achieve by calling the network management local group functions.

 

 

 

 

< Win32 Network Management APIs 3 | Win32 Network Management APIs | Win32 Programming | Win32 Network Management APIs 5 >