Windows Dev Center

Expand Minimize

DhcpV4SetPolicy function

The DhcpV4SetPolicy function updates one or more parameters of an existing policy.

Syntax


DWORD DHCP_API_FUNCTION DhcpV4SetPolicy(
  _In_opt_ LPWSTR          ServerIpAddress,
  _In_     DWORD           FieldsModified,
  _In_     BOOL            fGlobalPolicy,
  _In_     DHCP_IP_ADDRESS SubnetAddress,
  _In_     LPWSTR          PolicyName,
  _In_     LPDHCP_POLICY   Policy
);

Parameters

ServerIpAddress [in, optional]

Pointer to a null-terminated Unicode string that represents the IP address or hostname of the DHCP server.

FieldsModified [in]

A value from the DHCP_POLICY_FIELDS_TO_UPDATE enumeration that defines the DHCPv4 policy fields to modify.

fGlobalPolicy [in]

If TRUE the server level policy is set. Otherwise, the scope level policy is set.

SubnetAddress [in]

DHCP_IP_ADDRESS structure that contains the IPv4 subnet address of the policy to modify.

PolicyName [in]

A null-terminated Unicode string that represents the name of the policy to modify.

Policy [in]

Pointer to a DHCP_POLICY structure that contains the parameters of the policy to modify.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, it returns one of the following or an error code from DHCP Server Management API Error Codes.

ValueMeaning
ERROR_INVALID_PARAMETER

One or more of the parameters were invalid.

ERROR_DHCP_SUBNET_NOT_PRESENT

The specified IPv4 subnet does not exist.

ERROR_DHCP_RANGE_INVALID_IN_SERVER_POLICY

A policy range has been specified for a server level policy.

ERROR_DHCP_INVALID_POLICY_EXPRESSION

The specified conditions or expressions of the policy are invalid.

ERROR_DHCP_POLICY_RANGE_BAD

The specified policy range is not contained within the IP address range of the scope or the specified policy range is invalid.

ERROR_DHCP_POLICY_RANGE_EXISTS

The specified policy range overlaps with the policy ranges of an existing policy at the specified scope.

ERROR_DHCP_INVALID_PROCESSING_ORDER

The specified processing order is greater than the maximum processing order of the existing policies at the specified level (server or scope).

ERROR_DHCP_CLASS_NOT_FOUND

The vendor class or user class reference in the conditions of the policy does not exist.

 

Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Dhcpsapi.h

Library

Dhcpsapi.lib

DLL

Dhcpsapi.dll

See also

DhcpV4AddPolicyRange
DhcpV4CreatePolicy
DhcpV4DeletePolicy
DhcpV4EnumPolicies
DhcpV4QueryPolicyEnforcement
DhcpV4RemovePolicyRange
DhcpV4GetPolicy
DhcpV4SetPolicyEnforcement

 

 

Community Additions

ADD
Show:
© 2015 Microsoft