NetEnumerateServiceAccounts function

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(
  LPWSTR  ServerName,
  DWORD   Flags,
  DWORD   *AccountsCount,
  PZPWSTR *Accounts
);

Parameters

ServerName

The value of this parameter must be NULL.

Flags

This parameter is reserved. Do not use it.

AccountsCount

The number of elements in the Accounts array.

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

   
Windows version Windows 7 [desktop apps only] Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header lmaccess.h
DLL Netapi32.dll

See Also

NetAddServiceAccount

NetIsServiceAccount

NetRemoveServiceAccount