共用方式為


NetEnumerateServiceAccounts 函式 (lmaccess.h)

NetEnumerateServiceAccounts函式會列舉指定伺服器上 sMSA) (獨立受管理的服務帳戶。 此函式只會列舉 sMSA,而不是將受控服務帳戶群組 (gMSA) 。

此函式沒有相關聯的匯入程式庫。 您必須使用 LoadLibraryGetProcAddress 函式,動態連結至 Logoncli.dll。

語法

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

參數

[in, optional] ServerName

此參數的值必須是 Null

[in] Flags

此參數已保留備用。 不要使用它。

[out] AccountsCount

Accounts陣列中的專案數目。

[out] Accounts

指定伺服器上服務帳戶名稱陣列的指標。

當您使用完名稱時,請呼叫 NetApiBufferFree 函式來釋放陣列。

傳回值

如果函式成功,則會 傳回STATUS_SUCCESS

如果函式失敗,它會傳回錯誤碼。

需求

   
最低支援的用戶端 Windows 7 [僅限傳統型應用程式]
最低支援的伺服器 Windows Server 2008 R2 [僅限桌面應用程式]
目標平台 Windows
標頭 lmaccess.h
Dll Netapi32.dll

另請參閱

NetAddServiceAccount

NetIsServiceAccount

NetRemoveServiceAccount