DhcpSetOptionValues function (dhcpsapi.h)

The DhcpSetOptionValues function sets option codes and their associated data values for a specific scope defined on the DHCP server.

Syntax

DWORD DHCP_API_FUNCTION DhcpSetOptionValues(
  [in] DHCP_CONST WCHAR                   *ServerIpAddress,
  [in] DHCP_CONST DHCP_OPTION_SCOPE_INFO  *ScopeInfo,
  [in] DHCP_CONST DHCP_OPTION_VALUE_ARRAY *OptionValues
);

Parameters

[in] ServerIpAddress

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

[in] ScopeInfo

Pointer to a DHCP_OPTION_SCOPE_INFO structure that contains information describing the level (default, server, scope, or IPv4 reservation) at which this option value will be set.

[in] OptionValues

Pointer to a DHCP_OPTION_VALUE_ARRAY structure that contains a list of option codes and the corresponding data value that will be set for them.

Return value

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

Return code Description
ERROR_DHCP_JET_ERROR
An error occurred while accessing the DHCP server database.
ERROR_DHCP_OPTION_NOT_PRESENT
The specified option definition could not be found in the DHCP server database.
ERROR_DHCP_SUBNET_NOT_PRESENT
The specified IPv4 subnet does not exist on the DHCP server.
ERROR_DHCP_NOT_RESERVED_CLIENT
The specified DHCP client is not a reserved client.
ERROR_FILE_NOT_FOUND
The multicast scope specified in ScopeInfo was not found on the DHCP server.

Remarks

When this function is called for the first time, it creates the supplied option values in the DHCP server database. Otherwise, it modifies the option values for one or more options associated with the default user class and vendor class. These values can be set for the default, server, scope, or IPv4 reservation level on the DHCP server.

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_OPTION_SCOPE_INFO

DHCP_OPTION_VALUE_ARRAY

DhcpSetOptionValue

DhcpSetOptionValuesV5