NetStatisticsGet function (lmstats.h)

Retrieves operating statistics for a service. Currently, only the workstation and server services are supported.

Syntax

NET_API_STATUS NET_API_FUNCTION NetStatisticsGet(
  [in]  LPTSTR ServerName,
  [in]  LPTSTR Service,
  [in]  DWORD  Level,
  [in]  DWORD  Options,
  [out] LPBYTE *Buffer
);

Parameters

[in] ServerName

Pointer to a string that specifies the DNS or NetBIOS name of the server on which the function is to execute. If this parameter is NULL, the local computer is used.

[in] Service

Pointer to a string that specifies the name of the service about which to get the statistics. Only the values SERVICE_SERVER and SERVICE_WORKSTATION are currently allowed.

[in] Level

Specifies the information level of the data. This parameter can be the following value.

Value Meaning
0
Return statistics about a workstation or a server. The bufptr parameter points to a STAT_WORKSTATION_0 or a STAT_SERVER_0 structure.

[in] Options

This parameter must be zero.

[out] Buffer

Pointer to the buffer that receives the data. The format of this data depends on the value of the level parameter. This buffer is allocated by the system and must be freed using the NetApiBufferFree function. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths.

Return value

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes.

Remarks

No special group membership is required to obtain workstation statistics. Only members of the Administrators or Server Operators local group can successfully execute the NetStatisticsGet function on a remote server.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header lmstats.h (include Lm.h)
Library Netapi32.lib
DLL Netapi32.dll

See also

NetServerGetInfo

Network Management Functions

Network Management Overview

STAT_SERVER_0

STAT_WORKSTATION_0

Statistics Functions