Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

NetEnumerateServiceAccounts function (lmaccess.h)

The NetEnumerateServiceAccounts function enumerates the standalone managed service accounts (sMSA) on the specified server. This function only enumerates sMSAs and not group managed service accounts (gMSA).

This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Logoncli.dll.

Syntax

NTSTATUS NetEnumerateServiceAccounts(
 [in, optional] LPWSTR ServerName,
 [in] DWORD Flags,
 [out] DWORD *AccountsCount,
 [out] PZPWSTR *Accounts
);

Parameters

[in, optional] ServerName

The value of this parameter must be NULL.

[in] Flags

This parameter is reserved. Do not use it.

[out] AccountsCount

The number of elements in the Accounts array.

[out] Accounts

A pointer to an array of the names of the service accounts on the specified server.

When you have finished using the names, free the array by calling the NetApiBufferFree function.

Return value

If the function succeeds, it returns STATUS_SUCCESS.

If the function fails, it returns an error code.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header lmaccess.h
Library Netapi32.lib
DLL Netapi32.dll

See also

NetAddServiceAccount

NetIsServiceAccount

NetRemoveServiceAccount


Feedback

Was this page helpful?

Additional resources