Skip to main content
NetLogonSetServiceBits function

The NetLogonSetServiceBits function notifies the Netlogon service of the running state of the services on a domain controller. The caller must be running in the context of either the LocalSystem or the LocalService account.

Syntax


NTSTATUS WINAPI NetLogonSetServiceBits(
  _In_  LPWSTR ServerName,
  _In_  DWORD ServiceBitsOfInterest,
  _In_  DWORD ServiceBits
);

Parameters

ServerName [in]

A pointer to a null-terminated string that specifies the name of the domain controller. If this parameter is NULL, the local computer is used.

ServiceBitsOfInterest [in]

A set of flags used as a mask to indicate which service's state (running or not running) is being set. This parameter can be a combination of the following values.

ValueMeaning
DS_TIMESERV_FLAG
0x00000040

The state of the time service is being set.

DS_GOOD_TIMESERV_FLAG
0x00000200

The state of the time service with clock hardware is being set.

DS_WS_FLAG
0x00002000

The state of the Active Directory web service is being set.

 

ServiceBits [in]

A set of flags used as a mask to indicate whether the service indicated by ServiceBitsOfInterest parameter is running or not. If the flag is set to 0, the corresponding service indicated by the ServiceBitsOfInterest parameter is not running. Otherwise, if the flag is set to 1, the corresponding service indicated by the ServiceBitsOfInterest parameter is running. This parameter can be a combination of the following values.

ValueMeaning
DS_TIMESERV_FLAG
0x00000040

The time service is running.

DS_GOOD_TIMESERV_FLAG
0x00000200

The time service with clock hardware is running.

DS_WS_FLAG
0x00002000

The Active Directory web service is running.

 

Return value

If the function succeeds, the return value is STATUS_SUCCESS.

If the function fails, the return value can be one of the following error codes or one of the system error codes.

Return codeDescription
STATUS_ACCESS_DENIED

Access is denied. This error is returned if the caller was not a member of the Administrators local group on the target computer.

STATUS_INVALID_PARAMETER

A parameter is incorrect. This error is returned if one or more specified service bits are not valid.

 

Remarks

The list of running services for the domain controller returned by the DsGetDcName function will contain the running services notified by the NetLogonSetServiceBits function.

No header file is available for the NetLogonSetServiceBits function . Include the function definition at the top of this page in your source code.

An import library containing the NetLogonSetServiceBits function is not included in the Microsoft Windows Software Development Kit (SDK). Applications must use the LoadLibrary and GetProcAddress functions to retrieve the function pointer from the corresponding DLL and call this function.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

DLL

Netapi32.dll on Windows Vista and Windows Server 2008;
Logoncli.dll on Windows 7, Windows Server 2008 R2, Windows 8, and Windows Server 2012

See also

Directory Service functions
DsGetDcName
GetProcAddress
LoadLibrary
NetGetAnyDCName
NetGetDCName
Network Management Overview
Network Management Functions