NetAddServiceAccount function
The NetAddServiceAccount function creates a standalone managed service account (sMSA) or retrieves the credentials for a group managed service account (gMSA) and stores the account information on the local computer.
This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Logoncli.dll.
Windows Server 2008 R2: Installing a managed service account by using the PowerShell command line interface cmdlet to call this function fails with error code 0xC0000225 when the value of the AccountName parameter does not match the corresponding Security Accounts Manager (SAM) name of the account.
Syntax
NTSTATUS WINAPI NetAddServiceAccount( _In_opt_ LPWSTR ServerName, _In_ LPWSTR AccountName, _In_ LPWSTR Reserved, _In_ DWORD Flags );
Parameters
- ServerName [in, optional]
-
The value of this parameter must be NULL.
- AccountName [in]
-
The name of the account to be created.
- Reserved [in]
-
This parameter is reserved. Do not use it.
- Flags [in]
-
This parameter can be the following value.
Return value
If the function succeeds, it returns STATUS_SUCCESS.
If the function fails, it returns an error code.
Requirements
|
Minimum supported client |
Windows 7 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2008 R2 [desktop apps only] |
|
Header |
|
|
DLL |
|
See also