Use DHCP Commands Non-Interactively and in Scripts

Applies To: Windows Server 2008

You must be a member of the Administrators group or the DHCP Administrators group to administer DHCP servers using the DHCP console or the Netsh commands for DHCP. You should restrict the membership of these groups to the minimum number of users required to administer the server. In addition, only members of the Domain Admins group can authorize or unauthorize a DHCP server in AD DS. If there are users who need read-only access to the DHCP console, add them to the DHCP Users group instead of the DHCP Administrators group.

To use DHCP commands non-interactively or in scripts

  1. Open Command Prompt.

  2. At the command prompt or in scripted usage, you can use Netsh commands for DHCP non-interactively by using the following fully qualified command syntax:

    netsh dhcp server [**\\**ServerName] SubCommand

Additional considerations

The **\\**ServerName parameter is optional and can be left unspecified if you are performing commands locally at the DHCP server. If the server being managed is remote, this parameter is required, and the name of the server must be specified.

Additional references

For an example of how Netsh commands are used in a script, see Netsh DHCP Example (