DhcpV4DeletePolicy function (dhcpsapi.h)

The DhcpV4DeletePolicy function deletes an existing policy from the DHCP Server.

Syntax

DWORD DHCP_API_FUNCTION DhcpV4DeletePolicy(
  [in, optional] LPWSTR          ServerIpAddress,
  [in]           BOOL            fGlobalPolicy,
  [in]           DHCP_IP_ADDRESS SubnetAddress,
  [in]           LPWSTR          PolicyName
);

Parameters

[in, optional] ServerIpAddress

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

[in] fGlobalPolicy

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

[in] SubnetAddress

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

[in] PolicyName

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

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, it returns one of the following error codes.

Value Meaning
ERROR_DHCP_SUBNET_NOT_PRESENT
The specified IPv4 subnet does not exist.
ERROR_DHCP_POLICY_NOT_FOUND
The DHCP server policy was not found.
ERROR_INVALID_PARAMETER
The parameters were invalid.

Requirements

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

See also

DhcpV4AddPolicyRange

DhcpV4CreatePolicy

DhcpV4EnumPolicies

DhcpV4GetPolicy

DhcpV4QueryPolicyEnforcement

DhcpV4RemovePolicyRange

DhcpV4SetPolicy

DhcpV4SetPolicyEnforcement