Welcome to MSDN Blogs Sign in | Join | Help

How to set DHCP scope lease time through netsh?

In this post, I am going to talk about how to set the lease time for a given scope in the DHCP server through netsh command-line. The command is a little unintuitive considering the fact that you won't be mentioning anything about lease time in the command itself. The fact that you are updating the lease time is specified through the option-id for the lease time option. Without delaying any longer, let me give the command:

netsh dhcp server scope 10.0.0.0 set optionvalue 51 DWORD 3600

Let me explain this command: scope 10.0.0.0 specifies that you are going to change the lease time of the scope whose id is 10.0.0.0. 51 is the option-id for the option Lease time. This is an IETF assigned number: http://www.faqs.org/rfcs/rfc2132.html DWORD is the datatype of the lease-time option. And finally 3600 represents the option value in number of seconds.

Compare this to the way you edit the lease time in your snap-in. You right-click on the scope icon and click 'Properties' and change the lease time. That's it!! That's a lot simpler I must say....

Published Monday, March 28, 2005 5:00 AM by anto_rocks

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: How to set DHCP scope lease time through netsh?

Wednesday, May 11, 2005 6:12 AM by anto_rocks

# re: How to set DHCP scope lease time through netsh?

Tuesday, May 24, 2005 2:50 AM by Qflash

# re: Unlimited lease times through netsh

Tuesday, July 11, 2006 2:40 AM by Joergen Richter
Note that is not possible to set unlimites lease time by using set optionvalue 51 "-1". The command fails.
What you do instead is uset set optionsvalue "4294967296", which works fine.
(Yes, i had a little trouble on this)

# Follow-up article on how to set lease times through netsh.

Tuesday, July 18, 2006 7:47 AM by Microsoft DHCP Team Blogs.
Question: I have a customer that has 5 DHCP servers that host many scopes. The customer wants to know...

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker