DhcpDeleteSubnet function (dhcpsapi.h)

The DhcpDeleteSubnet function deletes a subnet from the DHCP server.

Syntax

DWORD DHCP_API_FUNCTION DhcpDeleteSubnet(
  [in] DHCP_CONST WCHAR *ServerIpAddress,
  [in] DHCP_IP_ADDRESS  SubnetAddress,
  [in] DHCP_FORCE_FLAG  ForceFlag
);

Parameters

[in] ServerIpAddress

Unicode string that specifies the IP address of the subnet to delete.

[in] SubnetAddress

DHCP_IP_ADDRESS value that contains the IP address of the subnet gateway used to identify the subnet.

[in] ForceFlag

DHCP_FORCE_FLAG enumeration value that indicates the type of delete operation to perform (full force, failover force, or no force).

Return value

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

Remarks

Usually, you will use either DhcpFullForce or DhcpNoForce as the value for ForceFlag. The DhcpFailoverForce value is intended for use when cleaning up a broken or improperly configured DHCP failover configuration. In that case, use of DhcpFailoverForce ensures that the entire DNS configuration isn't improperly deleted while cleaning up the DHCP failover configuration. Note that the minimum server OS requirement for DhcpFailoverForce is Windows Server 2012 R2 with KB 3100473 installed.

Requirements

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

See also

DHCP_FORCE_FLAG

DhcpCreateSubnet

DhcpEnumSubnets