Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

NetEnumerateComputerNames function

The NetEnumerateComputerNames function enumerates names for the specified computer.

Syntax


NET_API_STATUS  NetEnumerateComputerNames(
  _In_opt_  LPCWSTR Server,
  _In_      NET_COMPUTER_NAME_TYPE NameType,
  _In_      ULONG Reserved,
  _Out_     PDWORD EntryCount,
  _Out_     LPWSTR **ComputerNames
);

Parameters

Server [in, optional]

A pointer to a constant string that specifies the name of the computer on which to execute this function. If this parameter is NULL, the local computer is used.

NameType [in]

The type of the name queried. This member can be one of the following values defined in the NET_COMPUTER_NAME_TYPE enumeration defined in the Lmjoin.h header file.

ValueMeaning
NetPrimaryComputerName

The primary computer name.

NetAlternateComputerNames

Alternate computer names.

NetAllComputerNames

All computer names.

NetComputerNameTypeMax

Indicates the end of the range that specifies the possible values for the type of name to be queried.

 

Reserved [in]

Reserved for future use. This parameter should be NULL.

EntryCount [out]

A pointer to a DWORD value that returns the number of names returned in the buffer pointed to by the ComputerNames parameter if the function succeeds.

ComputerNames [out]

A pointer to an array of pointers to names. If the function call is successful, this parameter will return the computer names that match the computer type name specified in the NameType parameter.

When the application no longer needs this array, this buffer should be freed by calling NetApiBufferFree function.

Return value

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value can be one of the following error codes or one of the system error codes.

Return codeDescription
ERROR_ACCESS_DENIED

Access is denied. This error is returned if the caller was not a member of the Administrators local group on the target computer.

ERROR_INVALID_PARAMETER

A parameter is incorrect.

ERROR_NOT_ENOUGH_MEMORY

Not enough memory is available to process this command.

ERROR_NOT_SUPPORTED

The request is not supported. This error is returned if the target computer specified in the Server parameter on which this function executes is running on Windows 2000 and earlier.

NERR_WkstaNotStarted

The Workstation service has not been started.

RPC_S_CALL_IN_PROGRESS

A remote procedure call is already in progress for this thread.

RPC_S_PROTSEQ_NOT_SUPPORTED

The remote procedure call protocol sequence is not supported.

 

Remarks

The NetEnumerateComputerNames function is supported on Windows Vista and later.

The NetEnumerateComputerNames function is used to request the names a computer currently has configured.

The NetEnumerateComputerNames function requires that the caller is a member of the Administrators local group on the target computer.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Lmjoin.h (include Lm.h)

Library

Netapi32.lib

DLL

Netapi32.dll

See also

NetAddAlternateComputerName
NetJoinDomain
NetRemoveAlternateComputerName
NetRenameMachineInDomain
NetSetPrimaryComputerName
NetUnjoinDomain
SetComputerNameEx

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.