DhcpServerSetConfig function (dhcpsapi.h)

The DhcpServerSetConfig function configures a DHCPv4 server with specific settings, including information on the JET database used to store subnet and client lease information, and the supported protocols.

Syntax

DWORD DHCP_API_FUNCTION DhcpServerSetConfig(
  [in] DHCP_CONST WCHAR          *ServerIpAddress,
  [in] DWORD                     FieldsToSet,
  [in] LPDHCP_SERVER_CONFIG_INFO ConfigInfo
);

Parameters

[in] ServerIpAddress

Unicode string that specifies the IP address or hostname of the DHCP server.

[in] FieldsToSet

Specifies a set of bit flags that indicate which fields in ConfigInfo are set. If a flag is present, the corresponding field must also be populated in the DHCP_SERVER_CONFIG_INFO structure referenced by ConfigInfo, and will be used to set the same value on the DHCP server,

Value Meaning
Set_APIProtocolSupport
0x00000001
The APIProtocolSupport field is populated.
Set_DatabaseName
0x00000002
The DatabaseName field is populated.
Set_DatabasePath
0x00000004
The DatabasePath field is populated.
Set_BackupPath
0x00000008
The BackupPath field is populated.
Set_BackupInterval
0x00000010
The BackupInterval field is populated.
Set_DatabaseLoggingFlag
0x00000020
The DatabaseLoggingFlag field is populated.
Set_RestoreFlag
0x00000040
The RestoreFlag field is populated.
Set_DatabaseCleanupInterval
0x00000080
The DatabaseCleanupInterval field is populated.
Set_Set_DebugFlag
0x00000100
The DebugFlag field is populated.

[in] ConfigInfo

DHCP_SERVER_CONFIG_INFO structure that contains the specific configuration information to set on the DHCP server, as indicated by the flags specified in FieldsToSet.

Return value

This function returns ERROR_SUCCESS upon a successful call. Otherwise, it returns one of the DHCP Server Management API Error Codes.

Remarks

The DHCPv4 server must be restarted for the following settings to be effective:

  • Set_APIProtocolSupport
  • Set_DatabaseName
  • Set_DatabasePath
  • Set_DatabaseLoggingFlag
  • Set_RestoreFlag

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header dhcpsapi.h
Library Dhcpsapi.lib
DLL Dhcpsapi.dll

See also

DHCP_SERVER_CONFIG_INFO

DhcpServerGetConfig

DhcpServerSetConfigV4