NetRemoveServiceAccount function
The NetRemoveServiceAccount function deletes the specified service account from the Active Directory database if the account is a standalone managed service account (sMSA). For group managed service accounts (gMSAs), this function does not delete the account from the Active Directory database. The secret stored in the Local Security Authority (LSA) is deleted for both sMSAs and gMSAs, and the state is stored in the Netlogon registry store.
This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Logoncli.dll.
Syntax
NTSTATUS WINAPI NetRemoveServiceAccount( _In_opt_ LPWSTR ServerName, _In_ LPWSTR AccountName, _In_ DWORD Flags );
Parameters
- ServerName [in, optional]
-
The value of this parameter must be NULL.
- AccountName [in]
-
The name of the account to be deleted.
- Flags [in]
-
This parameter can have 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