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....