MORE INFORMATION
Downloading the Support Tools
To download the Windows NT 4.0 Support tools, see the following Microsoft Web site:
Dhcpcmd.exe Syntax
The syntax of the Dhcpcmd.exe tool is
dhcpcmd srvipaddress command [command parameters]
Where
command is one of the following commands:
General Commands
- AddReservedIp
- RemoveReservedIp
- GetVersion
- MibCounts
- ServerConfig
- CheckDB
Subnet Commands
- CreateSubnet
- DeleteSubnet
- SetSubnetState
Range Commands
- AddIpRange
- AddExcludeRange
- RemoveExcludeRange
Active-Lease Commands
Superscope Commands
- SetSuperScope
- DeleteSuperScope
- GetSuperScopeTable
- RemoveSubScope
Option Commands
- EnumOptions
- CreateOption
- DeleteOption
- SetGlobalOptionValue
- SetGlobalOptionValues
- RemoveGlobalOptionValue
- SetSubnetOptionValue
- RemoveSubnetOptionValue
- SetReservedOptionValue
- RemoveReservedOptionValue
General Commands
AddReservedIp
Description: Adds a reserved Transport Control Protocol/Internet Protocol (TCP/IP) address to an already existing scope.
Command syntax:
Dhcpcmd ServerIpAddress AddReservedIp ScopeAddress ReserveIp HardwareString [Clientname] [ClientComment] [DHCP|Bootp|Both]
Example:
dhcpcmd 127.0.0.1 addreservedip 11.101.0.0 11.101.13.53 08002B30369B nursvd1 dhcpRemoveReservedIp
Description: Removes a reserved TCP/IP address from the existing scope it belongs to.
Command syntax:
Dhcpcmd ServerIpAddress RemoveReservedIp ScopeAddress ReserveIp HardwareString
Example:
dhcpcmd 127.0.0.1 removereservedip 11.101.0.0 11.101.13.53 08002B30369BGetVersion
Description: Displays the DHCP server version
Command syntax:
Dhcpcmd ServerIpAddress GetVersion
Example:
dhcpcmd 127.0.0.1 getversionMibCounts
Description: Displays DHCP server statistic information for the current DHCP server.
Command syntax:
Dhcpcmd ServerIpAddress MibCounts
Example:
dhcpcmd 127.0.0.1 mibcountsServerConfig
Description: Displays and sets server parameters.
Command syntax:
Dhcpcmd ServerIpAddress ServerConfig [ConfigParameter] [Value]
Where
ConfigParameter is any of the DHCP server parameters, and
Value is the value you want to set that parameter to.
NOTE: Type
dhcpcmd serveripaddress serverconfig to display a list of the DHCP server parameters.
Examples:
dhcpcmd 127.0.0.1 serverconfig dhcpcmd 127.0.0.1 serverconfig backupinterval 15
The first example displays DHCP server parameters, and the second example sets the BackupInterval parameter to 15.
Checkdb
Description: Displays the DHCP scope information database.
Command syntax:
Dhcpcmd ServerIpAddress checkdb scope_address [Fix]
Example:
dhcpcmd 127.0.0.1 checkdb 11.101.0.0 fixNOTE: The
Fix parameter reconciles the database. If you do not use the
Fix parameter, only the DHCP server version and the "command successfully completed" informational message are displayed.
Subnet Commands
CreateSubnet
Description: Creates a new subnet, and should be immediately followed by the
AddIpRange command. If not, your computer can be inconsistent and the server may not behave as expected.
Command syntax:
Dhcpcmd server_IP_address CreateSubnet scope_address scope_mask scope_name
Example:
dhcpcmd 127.0.0.1 createsubnet 10.0.0.0 255.0.0.0 mysubnetDeleteSubnet
Description: Deletes an existing subnet.
Command syntax:
Dhcpcmd ServerIpAddress DeleteSubnet scope_address force_flag
Where
force_flag = dhcpfullforce or dhcpnoforce
If you use dhcpfullforce, all clients with active leases in that scope are deleted before the scope is deleted. If there are clients with active leases in a scope, dhcpfullforce must be specified or deletesubnet does not work.
Example:
dhcpcmd 127.0.0.1 deletesubnet 10.0.0.0 dhcpfullforce
This command deletes the subnet 10.0.0.0 and any leases that are present for this subnet.
SetSubnetState
Description: Enables and disables a subnet.
Command syntax:
Dhcpcmd ServerIpAddress setsubnetstate scope_address state
Where state has a value of 0 if the scope is to be enabled and a value of non-0 if the scope is to be disabled.
Example:
dhcpcmd 127.0.0.1 setsubnetstate 10.0.0.0 0Range Commands
AddIPRange
Description: Adds another IP range to an already existing scope.
Command syntax:
Dhcpcmd ServerIpAddress AddIPRange ScopeAddress StartIpRange EndIpRange
Example:
dhcpcmd 127.0.0.1 addiprange 11.101.0.0 11.101.4.1 11.101.4.254AddExcludeRange
Description: Adds a range of exclusion addresses to the scope.
Command syntax:
Dhcpcmd ServerIpAddress AddExcludeRange scope_address start_excl end_excl
Example:
dhcpcmd 127.0.0.1 addexcluderange 10.0.0.0 10.0.0.1 10.0.0.10
This command excludes IP addresses between 10.0.0.1 and 10.0.0.10.
RemoveExcludeRange
Description: Removes an existing exclusion range.
Command syntax:
Dhcpcmd ServerIpAddress RemoveExcludeRange scope_address start_excl end_excl
Example:
dhcpcmd 127.0.0.1 removeexcluderange 10.0.0.0 10.0.0.1 10.0.0.10
This command removes an existing exclusion of IP addresses from 10.0.01 to 10.0.0.10
Active-Lease Commands
EnumClients
Description: Lists the lease information in a different format.
Command syntax:
Dhcpcmd ServerIpAddress EnumClients ScopeAddress [-v | -h]
Where -v displays detailed lease information and -h displays lease and hardware information.
Example:
dhcpcmd 127.0.0.1 enumclients 11.101.0.0 -hSuperscope Commands
SetSuperScope
Description: Sets the superscope that a scope belongs to, creating the superscope if it does not already exist.
Command syntax:
Dhcpcmd ServerIpAddress SetSuperScope superscope_name scope_address {1/0}
If the value of the last parameter is 1, the superscope is changed even if the scope belongs to some another scope. If the value is 0, an error message is returned if the scope belongs to another superscope.
Example:
dhcpcmd 127.0.0.1 setsuperscope newsuperscope 10.0.0.0 1DeleteSuperScope
Description: Deletes a superscope and optionally converts all subordinate elements to a different superscope. If the target superscope does not exist, it is created.
Command syntax:
Dhcpcmd ServerIpAddress DeleteSuperScope [different_superscope_name]
Example:
dhcpcmd 127.0.0.1 deletesuperscope newsuperscopeGetSuperScopeTable
Description: Retrieves the full superscope information.
Command syntax:
Dhcpcmd ServerIpAddress GetSuperScopeTable
Example:
dhcpcmd 127.0.0.1 getsuperscopetableRemoveSubScope
Description: Removes a particular scope from its current superscope.
Command syntax:
Dhcpcmd ServerIpAddress RemoveSubScope subscope_address
Example:
dhcpcmd 127.0.0.1 removesubscope 10.0.0.0Option Commands
EnumOptions
Description: Lists all option information.
Command syntax:
Dhcpcmd ServerIpAddress EnumOptions
Example:
dhcpcmd 127.0.0.1 enumoptionsCreateOption
Description: Creates a new option definition.
Command syntax:
Dhcpcmd ServerIpAddress CreateOption option_idoption_name [default_value_type default_value]
Where
option_id is a number less than or equal to 255 and
value_type is one of the following values:
- Byte - An 8-bit unsigned integer
- Word - A 16-bit unsigned integer
- String - An ASCII text string
- IPAddress - A TCP/IP address in dotted-decimal w.x.y.z format
Example:
dhcpcmd 127.0.0.1 createoption 255 switchednetwkID string 0DeleteOption
Description: Deletes an existing option.
Command syntax:
Dhcpcmd ServerIpAddress DeleteOption option_id
Example:
dhcpcmd 127.0.0.1 deleteoption 253SetGlobalOptionValue
Description: Sets a global option value.
Command syntax:
Dhcpcmd ServerIpAddress SetGlobalOptionValue option_id option_type option_value
Example:
dhcpcmd 127.0.0.1 setglobaloptionvalue 255 string 111222333SetGlobalOptionValues
Description: Sets several global option values at a time.
Command syntax:
Dhcpcmd ServerIpAddress SetGlobalOptionValues option_id option_type option_value [option_id option_type option_value] [...]
Example:
dhcpcmd 127.0.0.1 setglobaloptionvalues 255 string 123 254 ipaddress 10.10.10.254RemoveGlobalOptionValue
Description: Removes the global option value. Note that this is not the same as removing the option itself.
Command syntax:
Dhcpcmd ServerIpAddress RemoveGlobalOptionValue option_id
Example:
dhcpcmd 135.1.1.1 removeglobaloptionvalue 255
The value is removed but the global option also disappears from the Option Configuration window and the option is put back in the unused option list. If you manually move it to the active option list, this option shows a value of 0 in the Option Configuration window.
SetSubnetOptionValue
Description: Adds an option value to a scope option.
Syntax:
Dhcpcmd ServerIpAddress SetSubnetOptionValue subnet_address option_id option_type option_value
Example:
dhcpcmd 137.1.1.254 setsubnetoptionvalue 120.1.1.0 255 string 123RemoveSubnetOptionValue
Description: Removes a subnet option.
Command syntax:
Dhcpcmd ServerIpAddress RemoveSubnetOptionValue subnet_address option_id
Example:
dhcpcmd 12.1.1.1 removesubnetoptionvalue 13.1.1.0 254
The value is changed to 0 and the option is still shown in the Option Configuration window.
SetReservedOptionValue
Description: Sets the option value for a reservation.
Command syntax:
Dhcpcmd ServerIpAddress SetReservedOptionValue reserved_subnet reserved_IP_address option_id option_type option_value
Example:
dhcpcmd 1.2.3.4 setreservedoptionvalue 12.1.1.0 12.1.1.1 255 string 777RemoveReservedOptionValue
Description: Removes an option defined for a reservation.
Command syntax:
Dhcpcmd ServerIpAddress RemoveReservedOptionValue reserved_subnet reserved_IP_address option_id
Example:
dhcpcmd 1.2.3.4 removereservedoptionvalue 12.1.1.0 12.1.1.1 255