wntShareUsers

Returns a list of users connected to a share or server.

Syntax:

wntShareUsers( server-name, share/computer-name, share-type, format, flags)

Parameters:

(s) server-name: name of a network file server or empty string ("") to indicate the current machine.

(s) share/computer-name: specifies either a share name (eg, "PUBLIC") on "server-name", or a computer name (eg, "\\FRED"). See explanation below.

(i) share-type: a bitmask specifying the type(s) of shares thatshould be returned. See below.

(i) format: specifies the information that will be returned for each connection. See Below.

(i) flags: reserved for future use and should be set to 0.

Returns:

(s) a tab delimited list of users connected to a share or server

 

"share-type" is a bitmask specifying the type(s) of shares that should be returned if "share/computer-name" specifies a computer name. It can be set to 0 to return all shares, or it can be one or more of the following values combined with the bitwise OR ('|') operator:

 

Value

Share type

1

Disk drive

2

Print queue

4

Communication device

8

Interprocess communication (IPC)

16

Administrative or special share (eg: C$, D$, ADMIN$, IPC$)

 

"format" specifies the information that will be returned for each connection. It can be one of the following values:

 

Value

Return format

1

username

2

netname

3

username|netname

 

This function can return either a list of users connected to a share, or a list of computers connected to a server. If "share/computer-name" specifies a share name, then the function will return a list of users connected to that share. If "share/computer-name" specifies a computer name, then the function will return a list of shares on "server-name" (filtered by "share-type") to which that computer is connected.

This function returns a tab-delimited list of user names and/or net names, depending on "format". The values returned are as follows:

username:

If "server-name" is running with user-level security, then "username" will be the name of the user who made the connection. If "server-name" is running with share-level security, then "username" will be the computer that made the connection.

netname:

"netname" is the opposite of "share/computer-name". In other words, if "share/computer-name" specifies a share name, then "netname" will be the name of the computer connected to that share, and if "share/computer-name" specifies a computer name, then "netname" will be the name of the share to which that computer is connected.

Note: Administrator, Server or Print Operator, or Power User group membership is required to successfully execute this function.

Example:
; Load Appropriate Extender
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')

list=wntShareUsers("", "PUBLIC", 1, 1, 0) AskItemlist("list of users connected to PUBLIC",list, @TAB, @UNSORTED, @SINGLE) Exit
See Also:

wntShareAdd, wntShareDel, wntShareInfo, wntShareList, wntShareSet