<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">A.J.Anto's WebLog</title><subtitle type="html">The DHCP one-stop shop.</subtitle><id>http://blogs.msdn.com/anto_rocks/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/anto_rocks/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2005-03-23T22:51:00Z</updated><entry><title>All about DHCP Auditing</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2006/11/02/all-about-dhcp-auditing.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2006/11/02/all-about-dhcp-auditing.aspx</id><published>2006-11-02T08:07:00Z</published><updated>2006-11-02T08:07:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;In this post, I would be discussing about DHCP Audit logging and how to tweak it to your specific situation. DHCP Audit logging can be customized using the following parameters:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;1)&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;The directory path in which the DHCP service stores audit log files: &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;2)&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;A maximum size restriction (in MB) for the total amount of disk space available for all the audit log files created and stored by the DHCP service.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;3)&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;An interval for disk checking that is used to determine how many times the DHCP server writes audit log events to the log file before checking for available disk space on the server.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;4)&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;A minimum size requirement (in MB) for server disk space that is used during disk checking to determine if sufficient space exists for the server to continue audit logging.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;In Win2K3, only parameter 1 (i.e. DHCP Audit file path) can be configured through netsh and mmc (Using the command netsh dhcp server set auditlog). The other parameters cannot be configured neither through MMC nor netsh. To set them, we need to set some registry keys:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;1)&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;To set the Maximum file size: You need to set the following key. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Key Name: HKLM\SYSTEM\CurrentControlSet\Services\DhcpServer\Parameters\&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;DhcpLogFilesMaxSize &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Key Type: REG_DWORD &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Value range: 0x0–0xFFFFFFFF MB &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Description:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Specifies the maximum combined size of one week's worth of Dynamic Host Configuration Protocol (DHCP) audit logs. If the audit logs exceed the size specified by this value, DHCP stops writing to the audit log until sufficient space becomes available.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;A href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/46691.mspx?mfr=true" mce_href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/46691.mspx?mfr=true"&gt;&lt;FONT face="Times New Roman" color=#800080 size=3&gt;http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/46691.mspx?mfr=true&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Times New Roman" size=3&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;2)&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;To set the Disk Check interval: You need to set the following key.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Key Name: HKLM\SYSTEM\CurrentControlSet\Services\DhcpServer\Parameters\DhcpLogDiskSpaceCheckInterval&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Key Type: REG_DWORD &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Value range: 0x0–0xFFFFFFFF number of audit log entries&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Description:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Determines how often Dynamic Host Configuration Protocol (DHCP) verifies that disk space and file size are adequate for its audit log. The value of this entry represents the number of audit log records entered between each verification check.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;A href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/46691.mspx?mfr=true" mce_href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/46691.mspx?mfr=true"&gt;&lt;FONT face="Times New Roman" color=#800080 size=3&gt;http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/46691.mspx?mfr=true&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Times New Roman" size=3&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;3)&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;To set the minimum disk space: You need to set the following key.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Key Name: HKLM\SYSTEM\CurrentControlSet\Services\DhcpServer\Parameters\DhcpLogMinSpaceOnDisk&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Key Type: REG_DWORD&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Key Value: 0x0–0xFFFFFFFF MB&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Description:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Specifies the minimum amount of free disk space required for audit logging.The Dynamic Host Configuration Protocol (DHCP) periodically verifies that it has sufficient disk space to proceed with audit logging (the interval is specified in the value of the DhcpLogDiskSpaceCheckInterval entry). This entry specifies the minimum value that DHCP requires. If the amount of free disk space is less than the value of this entry, then the DHCP service does not write to the audit log. Logging is suspended until sufficient disk space is available.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;A href="http://technet2.microsoft.com/WindowsServer/en/library/f7802dce-3ff9-406a-b3e6-c0c6b3ed49411033.mspx?mfr=true" mce_href="http://technet2.microsoft.com/WindowsServer/en/library/f7802dce-3ff9-406a-b3e6-c0c6b3ed49411033.mspx?mfr=true"&gt;&lt;FONT face="Times New Roman" color=#800080 size=3&gt;http://technet2.microsoft.com/WindowsServer/en/library/f7802dce-3ff9-406a-b3e6-c0c6b3ed49411033.mspx?mfr=true&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face="Times New Roman" size=3&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;In Longhorn Server, all the above functionality is exposed in the command netsh dhcp server set auditlog.&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;One more specific information I want to include in this post is about the delete policy of the DHCP Server with respect to old audit log files. The DHCP server does its auditing for a given day in a file corresponding to the day. For example, if the current day is wednesday, then it audit logs that day's events into the wednesday file. Like this for every day in the week, there is a audit log file. At 12:00 A.M. local time on the server computer, the DHCP server closes the existing log and moves to the log file for the next day of the week. For example, if the day of the week changes at 12:00 A.M. from Wednesday to Thursday, the log file named DhcpSrvLog-Wed.log is closed and the file named DhcpSrvLog-Thu.log is opened and used for logging events. &lt;/FONT&gt;&lt;/o:p&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;When the DHCP server starts or whenever a new day of the week occurs (when local time on the computer is 12:00 A.M.), the server writes a header message in the audit log file, indicating that logging started. Depending on whether the audit log file is a new or existing file, the following actions occur next:&lt;BR&gt;• If the audit log file has existed without modification for more than 24 hours, &lt;STRONG&gt;it is overwritten.&lt;/STRONG&gt;&lt;BR&gt;• If the file has existed but was modified within the previous 24 hours, the file is not overwritten. New logging activity is appended to the existing file. &lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;So if you want to make sure that your audit log files are appended and not overwritten, they must be changed in the last 24 hours. Let's say today is tuesday, and you want that auditing for tomorrow needs to be appended to last week's activity(and not overwritten), then you must edit the file DhcpLog-Wed.log. &lt;/FONT&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;For further information on DHCP Auditing, please refer: &lt;A href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/cnet/cncb_dhc_tmvc.mspx?mfr=true" mce_href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/cnet/cncb_dhc_tmvc.mspx?mfr=true"&gt;http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/cnet/cncb_dhc_tmvc.mspx?mfr=true&lt;/A&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=928267" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>RManager - A tool to manage reservations</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2006/08/23/714685.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="5955" href="http://blogs.msdn.com/anto_rocks/attachment/714685.ashx" /><id>http://blogs.msdn.com/anto_rocks/archive/2006/08/23/714685.aspx</id><published>2006-08-23T17:10:00Z</published><updated>2006-08-23T17:10:00Z</updated><content type="html">&lt;P&gt;&lt;STRONG&gt;&lt;FONT size=4&gt;Reservation Manager:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR&gt;Reservations&amp;nbsp;are a critical feature in the DHCP server. Reservations’ are generally used for centralized static IP address assignment for critical machines. This way the IP address of the critical machines which serves critical functions in the network will not have dynamically assigned IP address which can change over time. The reservation manager is a tool which will help solve typical reservation-related problems which the network admins might face. More often than not this tool tries to automate problems to recurring customer problems. It tries to solve the following reservation-related problems:&lt;BR&gt;&lt;STRONG&gt;1) Migrating reservations from one DHCP Server to another on specific subnets.&lt;/STRONG&gt;&lt;BR&gt;As a general best-practice, reservations must be duplicated across all DHCP servers serving the same subnet. This particular functionality addresses this best-practice. Without this the admin has to manually dump reservations from one server to another. This command takes 3+ arguments. The first argument tells the destination DHCP server IP address to which the reservations must be copied to. The second argument identifies the IP Address of the source DHCP server. The last argument is either ‘all’ or identifies the first scope address on which this operation has to be performed. The third argument can be followed by n number of arguments which identify the different subnet’s to which this operation has to be performed.&lt;BR&gt;Example:&lt;BR&gt;cscript rmanager.vbs Rmanager –migrate 10.0.0.1 11.0.0.1 all&lt;BR&gt;This command will copy all reservations in all scopes from the server 10.0.0.1 to the server 11.0.0.1.&lt;BR&gt;cscript rmanager.vbs Rmanager –migrate 10.0.0.1 11.0.0.1 12.0.0.0 10.0.0.0 11.0.0.0&lt;BR&gt;This command will copy reservations from the scopes 12.0.0.0 10.0.0.0 and 11.0.0.0 from the server 10.0.0.1 to 11.0.0.1.&lt;BR&gt;For this command to work properly the specified scope/scopes should be present in both the servers. An error message will be printed for those scopes for which this condition is not met. Also for those reservations which cannot be added successfully for whatever reason, an error is printed. Also for every successfully migrated reservation, it can be printed.&lt;BR&gt;In addition to this, this command can also take an additional preview switch which will just print the action which will be taken and not actually take the action. This is especially useful when the admin wants to review the action before doing it.&lt;BR&gt;Example:&lt;BR&gt;cscript rmanager.vbs Rmanager –migrate 10.0.0.1 11.0.0.1 all –preview out.txt&lt;BR&gt;cscript rmanager.vbs Rmanager –migrate 10.0.0.1 11.0.0.1 12.0.0.0 10.0.0.0 11.0.0.0 –preview out.txt&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2) Synchronizing reservations on 2 DHCP servers on specific subnets.&lt;/STRONG&gt;&lt;BR&gt;As already mentioned, it is a general best-practice for reservations must be duplicated across all DHCP servers serving the same subnet. This particular functionality addresses this best-practice in a more subter way. Instead of copying reservations from one server to another, this option lets the admin to synchronize the reservation lists between two servers. The arguments for this switch is exactly similar to that of the migrate switch. This command also has an optional preview switch.&lt;BR&gt;Example:&lt;BR&gt;cscript rmanager.vbs&amp;nbsp;Rmanager –sync 10.0.0.1 11.0.0.1 all&lt;BR&gt;This command will sync all reservations in all scopes from the server 11.0.0.1 to the server 10.0.0.1.&lt;BR&gt;cscript rmanager.vbs Rmanager –sync 10.0.0.1 11.0.0.1 12.0.0.0 10.0.0.0 11.0.0.0&lt;BR&gt;For this command to work properly the specified scope/scopes should be present in both the servers. An error message will be printed for those scopes for which this condition is not met. Also for those reservations which cannot be added successfully for whatever reason, an error is printed. Also for every successfully migrated reservation, it can be printed.&lt;BR&gt;In addition to this, this command can also take an additional preview switch which will just print the action which will be taken and not actually take the action. This is especially useful when the admin wants to review the action before doing it.&lt;BR&gt;Example:&lt;BR&gt;cscript rmanager.vbs Rmanager –sync 10.0.0.1 11.0.0.1 all –preview out.txt&lt;BR&gt;cscript rmanager.vbs Rmanager –sync 10.0.0.1 11.0.0.1 12.0.0.0 10.0.0.0 11.0.0.0 –preview out.txt&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3) Dumping leases on specific subnets.&lt;/STRONG&gt;&lt;BR&gt;This command dumps the leases for a specific scope and server into a human-editable text file. The file will contains several lines each of which corresponds to a single lease. A lease is represented by IP address and MAC address. The exact utility of this command will be exposed once you see the next section.&lt;BR&gt;Example:&lt;BR&gt;cscript rmanager.vbs Rmanager -dumplease out.txt 120.0.0.1 all&lt;BR&gt;The above command dumps all leases in all scopes in the server 120.0.0.1 to a text file called "out.txt"&lt;BR&gt;cscript rmanager.vbs Rmanager -dumplease out.txt 120.0.0.1 10.0.0.0 11.0.0.0&lt;BR&gt;The above command dumps all leases in scopes 10.0.0.0 and 11.0.0.0 in the server 120.0.0.1 to a text file called "out.txt"&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4) MakeReservation switch.&lt;/STRONG&gt;&lt;BR&gt;This switch tries to create reservations on a given DHCP server from the information present in a given input file. The input file contains several lines of info. Each line corresponds to a single reservation. Each reservation is represented by IP address and MAC address pair. The format of this input file is exactly the same as the output file of the -dumplease switch.&lt;BR&gt;Example:&lt;BR&gt;cscript rmanager.vbs Rmanager -makereservation 120.0.0.1 out.txt&lt;BR&gt;This command will create reservations out of information present in the file out.txt in the server 120.0.0.1. &lt;/P&gt;
&lt;P&gt;Based on the -dumplease and -makereservation switch, some interesting possibilities arise. What is possible is the following scenario: An admin has an active DHCP server which has a couple of scopes. Initially there are no reservations in any of these scopes. Thus all the subnets corresponding to these scopes have dynamic addresses. In the environment any machine which is plugged into the these subnets will get a dynamic IP address from the DHCP server. Now to restrict the access of the network to those machines that are already connected to the network, the admin can do the following. &lt;BR&gt;cscript rmanager.vbs Rmanager -dumplease out.txt 120.0.0.1 all&lt;BR&gt;cscript rmanager.vbs Rmanager -makereservation 120.0.0.1 out.txt&lt;BR&gt;These two commands intends to convert every active lease in a given DHCP server identified by an IP address in a given set of scopes identified by a list of scope addresses into reservations. Once this is done, the admin also has to make sure that the whole address space in the given scope in the DHCP server are excluded. This operation is thus particularly relevant to those admins who might want to move from a pure Dynamic IP address assignment to a more controlled purely reservation oriented address assignment. This way the admin can keep track of who is getting IP addresses and can limit the network access to those clients who already have an IP address.&lt;BR&gt;The first command Rmanager -dumplease &amp;lt;filename&amp;gt; &amp;lt;Scope Identifiers&amp;gt; will dump all the active leases in the specified server and scope to a text file. This text file will have pair of IP address and MAC addresses. The second command Rmanager –makereservation &amp;lt;ServerIdentifier&amp;gt; &amp;lt;filename&amp;gt; will take the file which is generated by the first command and create reservations corresponding to them. The idea behind separating these two actions is to make sure that the admin gets a chance to edit the file generated by the first command before proceeding to the second. Also we want to support scenarios where the admin can just create the file and use it to run the second command directly.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;In the attachment (See the link at the end of this post), Find the RManager.vbs .You need to extract the contents of the zip file into a separate folder and run it from there. The zip file should contain two files: rmanager.vbs and help.txt.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;If you are not able to get it, Cut-copy-paste the following into a file named rmanager.vbs. Also copy the contents of the documentation help.txt&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Run it by typing "cscript rmanager.vbs"&lt;/P&gt;
&lt;P&gt;X-----------------------Begin Paste---------------------X&lt;/P&gt;
&lt;P&gt;call start()&lt;BR&gt;dim scopes&lt;BR&gt;dim synccount&lt;BR&gt;dim argerror&lt;BR&gt;dim iparray&lt;BR&gt;dim macarray&lt;BR&gt;dim finaliparray&lt;BR&gt;dim finalmacarray&lt;BR&gt;dim m&lt;BR&gt;dim args&lt;/P&gt;
&lt;P&gt;sub start()&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;args=0&amp;nbsp;&lt;BR&gt;&amp;nbsp;synccount=0&lt;BR&gt;&amp;nbsp;argerror=0&lt;BR&gt;&amp;nbsp;if(wscript.arguments.count=0) then&lt;BR&gt;&amp;nbsp;wscript.echo "enter the command"&lt;BR&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;for i=0 to wscript.arguments.count-1&lt;BR&gt;&amp;nbsp;if(i=0) then&lt;BR&gt;&amp;nbsp;str=wscript.arguments.item(i)&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;str=str&amp;amp;" "&amp;amp;wscript.arguments.item(i)&lt;BR&gt;&amp;nbsp;end if&amp;nbsp;&lt;BR&gt;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;str1=split(str)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;'show error if nothing is entered------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if (not isarray(str1)) then&lt;BR&gt;&amp;nbsp;wscript.echo "Error: unrecongnized or incomplete command line."&lt;BR&gt;&amp;nbsp;call helpfile()&lt;BR&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;'checking if the command is Rmanager or not&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if(strcomp("Rmanager",str1(0))&amp;lt;&amp;gt;0) then&lt;BR&gt;&amp;nbsp;wscript.echo "Error: unrecongnized or incomplete command line."&lt;BR&gt;&amp;nbsp;call helpfile()&lt;BR&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;'checking for different cases after Rmanager&lt;BR&gt;&amp;nbsp;if(ubound(str1)=0) then&lt;BR&gt;&amp;nbsp;wscript.echo "Error: unrecongnized or incomplete command line."&lt;BR&gt;&amp;nbsp;call helpfile()&lt;BR&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;select case str1(1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;case "-migrate"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;call migrate(str1)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;case "-sync"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;call migrate(str1)&lt;BR&gt;&amp;nbsp;&amp;nbsp;if(argerror=1) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;synccount=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;a=str1(2)&lt;BR&gt;&amp;nbsp;&amp;nbsp;str1(2)=str1(3)&lt;BR&gt;&amp;nbsp;&amp;nbsp;str1(3)=a&lt;BR&gt;&amp;nbsp;&amp;nbsp;call migrate(str1)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;case "-dumplease"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;call dump(str1)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;case "-makereservation"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;call makereservation(str1)&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;case "/?"&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;call helpfile()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;case else&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "Error: unrecongnized or incomplete command line."&lt;BR&gt;&amp;nbsp;&amp;nbsp;call helpfile()&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;end select&lt;BR&gt;&amp;nbsp;&lt;BR&gt;'delete the scopefile that is created during the program&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;if(fso.fileexists("scopefile.txt"))then&lt;BR&gt;fso.deletefile("scopefile.txt"),true&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;end sub&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;' function for dumplease&lt;/P&gt;
&lt;P&gt;sub dump(str1)&lt;/P&gt;
&lt;P&gt;'if improper arguments are entered show error&lt;/P&gt;
&lt;P&gt;if ubound(str1)&amp;lt;4 then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;wscript.echo "Error: unrecongnized or incomplete command line."&lt;BR&gt;call helpfile()&lt;BR&gt;exit sub&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;filename = str1(2)&lt;BR&gt;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;&amp;nbsp;Set outfile = fso.CreateTextFile(filename)&lt;BR&gt;&amp;nbsp;outfile.close&lt;/P&gt;
&lt;P&gt;p=checkserver(str1(3))&lt;/P&gt;
&lt;P&gt;if p=0 then&lt;BR&gt;wscript.echo "server "&amp;amp;str1(3)&amp;amp;" not present or is entered wrongly"&lt;BR&gt;exit sub&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;serverarray = makescopearray(scopes)&lt;/P&gt;
&lt;P&gt;if not isarray(serverarray) then&lt;BR&gt;wscript.echo "no scopes in server "&amp;amp;str1(3)&lt;BR&gt;exit sub&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;if (strcomp(str1(4),"all")=0) then &lt;/P&gt;
&lt;P&gt;&amp;nbsp;if(ubound(str1)=4) then&lt;BR&gt;&amp;nbsp;scope = serverarray&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;wscript.echo "improper arguments"&lt;BR&gt;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;else&lt;/P&gt;
&lt;P&gt;for i = 4 to ubound(str1)&lt;BR&gt;if(isscope(str1(i),serverarray)) then&lt;BR&gt;redim preserve scope(i-4)&lt;BR&gt;scope(i-4)=str1(i)&lt;BR&gt;else&lt;BR&gt;wscript.echo "scope "&amp;amp; str1(i) &amp;amp;" is not present in server "&amp;amp;str1(3)&lt;BR&gt;exit sub&lt;BR&gt;end if&lt;BR&gt;next&lt;BR&gt;end if&lt;BR&gt;'scope contains all the scopes entered&lt;BR&gt;if not isarray(scope) then&lt;BR&gt;wscript.echo "no scopes in the server "&amp;amp;str1(3)&lt;BR&gt;else&lt;BR&gt;if scope(0)="" then&lt;BR&gt;wscript.echo "no scopes in the server "&amp;amp;str1(3)&lt;BR&gt;else&lt;BR&gt;&amp;nbsp;set wshell = CreateObject("WScript.Shell") &lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;for i = 0 to ubound(scope)&lt;BR&gt;&amp;nbsp;set obj = wshell.exec("netsh dhcp server "&amp;amp;str1(3)&amp;amp;" scope "&amp;amp;scope(i)&amp;amp;" show clients")&lt;BR&gt;&amp;nbsp;clients = obj.stdout.readall()&lt;BR&gt;&amp;nbsp;if(instrrev(clients,"Command completed successfully.")=0) then&lt;BR&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&amp;nbsp;&lt;BR&gt;&amp;nbsp;call makeclients(clients,str1(2))&amp;nbsp;&lt;BR&gt;&amp;nbsp;next&lt;BR&gt;end if&lt;BR&gt;end if&lt;BR&gt;if args = 0 then&lt;BR&gt;else&lt;BR&gt;wscript.echo "the ipaddress and macaddress pair are in file "&amp;amp;filename&lt;BR&gt;end if&lt;BR&gt;end sub&lt;/P&gt;
&lt;P&gt;'the following procedure outputs the ip and corresponding mac addresses(active leases) into the file - 'filename'...it takes the output string clients that we get after executing the command shoe clients&lt;/P&gt;
&lt;P&gt;sub makeclients(clients,filename)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;&amp;nbsp;Set scopefile = fso.CreateTextFile("scopefile.txt")&lt;BR&gt;&amp;nbsp;scopefile.writeline(clients)&lt;BR&gt;&amp;nbsp;scopefile.close&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;Set scopefile = fso.OpenTextFile("scopefile.txt")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;do While not scopefile.AtEndOfStream&amp;nbsp;&amp;nbsp;&amp;nbsp;'reading line by line and checking for the string "Total No. of Scopes"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;line = scopefile.ReadLine&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(instr(line,"No of Clients")=1) then&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;str = split(line)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;t=str(4)&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'taking no. of clients into t&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit do&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;loop&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;scopefile.close&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;t=cint(t)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if t=0 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;wscript.echo "no clients in the scope "&amp;amp;str(ubound(str))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;args=args+1&lt;BR&gt;Set scopefile = fso.OpenTextFile("scopefile.txt")&lt;BR&gt;for i= 1 to 8&lt;BR&gt;scopefile.skipline&lt;BR&gt;next&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set outfile = fso.opentextfile(filename,8)&lt;/P&gt;
&lt;P&gt;for i=0 to t-1&lt;BR&gt;line=scopefile.readline&lt;/P&gt;
&lt;P&gt;str= split(line)&lt;/P&gt;
&lt;P&gt;if (instr(line,"INACTIVE")&amp;lt;&amp;gt;0) then&lt;BR&gt;d=0&lt;BR&gt;&amp;nbsp;for l=0 to ubound(str)&lt;BR&gt;&amp;nbsp;if(str(l)="") then&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;if d=3 then &lt;BR&gt;&amp;nbsp;exit for&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;d=d+1&amp;nbsp;&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;&lt;BR&gt;outfile.write(str(0))&lt;BR&gt;for size = 1 to 18-(len(str(0)))&lt;BR&gt;outfile.write(" ")&lt;BR&gt;next &lt;/P&gt;
&lt;P&gt;outfile.writeline(trim(replace(str(l),"-","")))&lt;/P&gt;
&lt;P&gt;else&lt;BR&gt;d=0&lt;BR&gt;&amp;nbsp;for l=0 to ubound(str)&lt;BR&gt;&amp;nbsp;if(str(l)="") then&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;if d=4 then &lt;BR&gt;&amp;nbsp;exit for&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;d=d+1&amp;nbsp;&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;next&lt;BR&gt;outfile.write(str(0))&lt;BR&gt;for size = 1 to 18-(len(str(0)))&lt;BR&gt;outfile.write(" ")&lt;BR&gt;next &lt;/P&gt;
&lt;P&gt;outfile.writeline(trim(replace(str(l),"-","")))&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;end if&lt;BR&gt;next&lt;BR&gt;outfile.close&lt;BR&gt;end sub&lt;/P&gt;
&lt;P&gt;sub makereservation(str1)&lt;/P&gt;
&lt;P&gt;if ubound(str1)&amp;lt;&amp;gt;3 then&lt;BR&gt;wscript.echo "Error: unrecongnized or incomplete command line."&lt;BR&gt;call helpfile()&lt;BR&gt;exit sub&lt;BR&gt;end if &lt;/P&gt;
&lt;P&gt;server = str1(2)&lt;BR&gt;filename = str1(3)&lt;/P&gt;
&lt;P&gt;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;if(not fso.fileexists(filename))then&lt;BR&gt;wscript.echo "file "&amp;amp;filename&amp;amp;" not present"&lt;BR&gt;exit sub&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;k = checkserver(server)&lt;BR&gt;if k=0 then&lt;BR&gt;wscript.echo "server "&amp;amp;server&amp;amp;" is not present or may have been entered wrongly"&lt;BR&gt;exit sub&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;scopearray=makescopearray(scopes)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'scopes is the output string obtained after executing show scope command for given server&lt;/P&gt;
&lt;P&gt;set handle = fso.opentextfile(filename)&lt;/P&gt;
&lt;P&gt;Dim ipaddress &lt;BR&gt;Dim macaddress &lt;BR&gt;t=0&lt;BR&gt;do while not handle.atendofstream&lt;/P&gt;
&lt;P&gt;&amp;nbsp;line=trim(handle.readline)&lt;BR&gt;&amp;nbsp;line=replace(line,"&amp;nbsp;","")&amp;nbsp;&lt;BR&gt;&amp;nbsp;if line="" then &lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;strarray=split(line)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;p=0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;for k=0 to ubound(strarray)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if strarray(k)="" then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if p=0 then&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ipaddress=trim(strarray(k))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else if p=1 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;macaddress = trim(strarray(k))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p=p+1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'wscript.echo Replace(ipaddress, "&amp;nbsp;", "")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'wscript.echo macaddress&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;if p&amp;lt;&amp;gt;2 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "improper format of file"&lt;BR&gt;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;redim preserve iparray3(t)&lt;BR&gt;&amp;nbsp;redim preserve macarray3(t)&lt;BR&gt;&amp;nbsp;iparray3(t)=ipaddress&lt;BR&gt;&amp;nbsp;macarray3(t)=macaddress&lt;BR&gt;&amp;nbsp;t=t+1&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;loop&lt;BR&gt;handle.close&lt;/P&gt;
&lt;P&gt;if not isarray(iparray3) then&lt;BR&gt;wscript.echo "there is nothing in the file"&lt;BR&gt;exit sub&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;dim arr&lt;BR&gt;redim arr(t-1)&lt;BR&gt;&amp;nbsp;&lt;BR&gt;for i = 0 to ubound(scopearray)&lt;BR&gt;&amp;nbsp;&lt;BR&gt;set iprange = fso.createtextfile("iprangefile.txt")&lt;BR&gt;iprange.close&lt;BR&gt;arraysize = 0&lt;BR&gt;dim iparray1&lt;BR&gt;redim iparray1(0)&lt;BR&gt;redim macarray1(0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;set wshell = CreateObject("WScript.Shell") &lt;BR&gt;&amp;nbsp;set obj = wshell.exec("netsh dhcp server "&amp;amp;server&amp;amp;" scope "&amp;amp;scopearray(i)&amp;amp;" show iprange")&lt;BR&gt;&amp;nbsp;range = obj.stdout.readall()&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;set iprange = fso.opentextfile("iprangefile.txt",8)&lt;BR&gt;&amp;nbsp;iprange.writeline(range)&lt;BR&gt;&amp;nbsp;iprange.close&lt;BR&gt;&amp;nbsp;set iprange = fso.opentextfile("iprangefile.txt")&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;for p=0 to 5 &lt;BR&gt;&amp;nbsp;iprange.skipline&lt;BR&gt;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;line1=iprange.readline&lt;BR&gt;&amp;nbsp;line2=split(line1)&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;count=0&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;for j=0 to t-1&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;k = checkiprange(line2(3),line2(13),iparray3(j))&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;if k = 1 then&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;redim preserve iparray1(arraysize)&lt;BR&gt;&amp;nbsp;redim preserve macarray1(arraysize)&lt;BR&gt;&amp;nbsp;iparray1(arraysize) = iparray3(j)&lt;BR&gt;&amp;nbsp;macarray1(arraysize) = macarray3(j)&amp;nbsp;&lt;BR&gt;&amp;nbsp;arraysize = arraysize + 1&lt;BR&gt;&amp;nbsp;arr(j)=1&lt;BR&gt;&amp;nbsp;else if k=2 then&lt;BR&gt;&amp;nbsp;wscript.echo "the ip address "&amp;amp;iparray3(j)&amp;amp;" is not valid"&amp;nbsp;&lt;BR&gt;&amp;nbsp;fso.deletefile("iprangefile.txt"),true&lt;BR&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&amp;nbsp;&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;next&amp;nbsp;&lt;/P&gt;
&lt;P&gt;iprange.close&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;if isarray(iparray1) and not iparray1(0)="" then&lt;/P&gt;
&lt;P&gt;call addreservation(server,scopearray(i),iparray1,macarray1)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if (finaliparray(0)="") then&lt;/P&gt;
&lt;P&gt;else&lt;BR&gt;for l=0 to ubound(finaliparray)&lt;BR&gt;set obj = wshell.exec("netsh dhcp server "&amp;amp;server&amp;amp;" scope " &amp;amp;scopearray(i)&amp;amp; " add reservedip "&amp;amp;finaliparray(l)&amp;amp;" "&amp;amp;finalmacarray(l) )&lt;BR&gt;outp = &amp;nbsp;obj.stdout.readall()&lt;BR&gt;&amp;nbsp;&amp;nbsp;if(instr(outp,"Command completed successfully.")&amp;lt;&amp;gt;0) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "added reservation "&amp;amp;finaliparray(l)&amp;amp; " "&amp;amp;finalmacarray(l)&amp;amp;" to server "&amp;amp;server&amp;amp;" in scope "&amp;amp;scopearray(i)&lt;BR&gt;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "The specified IP address "&amp;amp;finaliparray(l)&amp;amp; " or hardware address "&amp;amp; finalmacarray(l)&amp;amp; " is either not proper or is being used by another client."&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;next&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;end if&lt;BR&gt;redim iparray1(0)&lt;BR&gt;redim macarray1(0)&lt;/P&gt;
&lt;P&gt;next&lt;/P&gt;
&lt;P&gt;set handle = fso.opentextfile(filename)&lt;BR&gt;for i=0 to ubound(arr)&lt;BR&gt;str=trim(handle.readline)&lt;/P&gt;
&lt;P&gt;if(arr(i)=0) then&lt;BR&gt;line=split(str)&lt;/P&gt;
&lt;P&gt;wscript.echo "The ipaddress "&amp;amp;iparray3(i)&amp;amp;" is not present in any scope"&lt;BR&gt;end if&lt;BR&gt;next&lt;BR&gt;handle.close&lt;BR&gt;fso.deletefile("iprangefile.txt"),true&lt;BR&gt;end sub&lt;/P&gt;
&lt;P&gt;sub addreservation(server,scopestr,iparraysource,macarraysource)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;redim finaliparray(0)&lt;BR&gt;&amp;nbsp;redim finalmacarray(0)&lt;BR&gt;&amp;nbsp;set wshell = CreateObject("WScript.Shell") &lt;BR&gt;&amp;nbsp;set obj = wshell.exec("netsh dhcp server "&amp;amp;server&amp;amp;" scope " &amp;amp;scopestr&amp;amp; " show reservedip" )&lt;BR&gt;&amp;nbsp;outpdest = obj.stdout.readall()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;call makeipandmacarray(outpdest)&lt;BR&gt;&amp;nbsp;iparraydest = iparray&lt;BR&gt;&amp;nbsp;macarraydest = macarray&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;' remove common ip and mac pair between the two servers for the given scope&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;if(not isarray(iparraydest)) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;finaliparray=iparraysource&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;finalmacarray=macarraysource&amp;nbsp;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;k=0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;for i = 0 to ubound(iparraysource)&lt;BR&gt;&amp;nbsp;&amp;nbsp;flag=0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for j=0 to ubound(iparraydest)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(iparraysource(i)=iparraydest(j) and macarraysource(i)=macarraydest(j)) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;flag=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit for&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;if flag=1 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if synccount = 0 and m=0 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "reservation "&amp;amp;iparraysource(i)&amp;amp;" "&amp;amp;macarraysource(i)&amp;amp;" is already present on server "&amp;amp;server&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;redim preserve finaliparray(k)&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;redim preserve finalmacarray(k)&lt;BR&gt;&amp;nbsp;&amp;nbsp;finaliparray(k)=iparraysource(i)&lt;BR&gt;&amp;nbsp;&amp;nbsp;finalmacarray(k)=macarraysource(i)&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;k=k+1&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;end sub&lt;/P&gt;
&lt;P&gt;function checkiprange(ip1,ip2,ip3)&lt;/P&gt;
&lt;P&gt;str2=split(ip1,".")&lt;BR&gt;str3=split(ip2,".")&lt;BR&gt;str4=split(ip3,".")&lt;BR&gt;if ubound(str4)&amp;lt;&amp;gt;3 then&lt;BR&gt;checkiprange=2&lt;BR&gt;exit function&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;dim string&lt;/P&gt;
&lt;P&gt;if cint(str2(0))&amp;lt;=cint(str4(0)) and cint(str4(0))&amp;lt;=cint(str3(0)) then&lt;BR&gt;&amp;nbsp;if cint(str2(1))&amp;lt;=cint(str4(1)) and cint(str4(1))&amp;lt;=cint(str3(1)) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;for i=2 to 3&lt;BR&gt;if(cint(str2(i))&amp;gt;=0 and cint(str2(i))&amp;lt;10) then&lt;BR&gt;string1=string1&amp;amp;"00"&amp;amp;str2(i)&lt;BR&gt;else if(cint(str2(i))&amp;gt;=10 and cint(str2(i))&amp;lt;100) then&lt;BR&gt;string1=string1&amp;amp;"0"&amp;amp;str2(i)&lt;BR&gt;end if&lt;BR&gt;end if&lt;BR&gt;next&lt;BR&gt;for i=2 to 3&lt;BR&gt;if(cint(str3(i))&amp;gt;=0 and cint(str3(i))&amp;lt;10) then&lt;BR&gt;string2=string2&amp;amp;"00"&amp;amp;str3(i)&lt;BR&gt;else if(cint(str3(i))&amp;gt;=10 and cint(str3(i))&amp;lt;100) then&lt;BR&gt;string2=string2&amp;amp;"0"&amp;amp;str3(i)&lt;BR&gt;end if&lt;BR&gt;end if&lt;BR&gt;next&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;for i=2 to 3&lt;BR&gt;if(cint(str4(i))&amp;gt;=0 and cint(str4(i))&amp;lt;10) then&lt;BR&gt;string3=string3&amp;amp;"00"&amp;amp;str4(i)&lt;BR&gt;else if(cint(str4(i))&amp;gt;=10 and cint(str4(i))&amp;lt;100) then&lt;BR&gt;string3=string3&amp;amp;"0"&amp;amp;str4(i)&lt;BR&gt;end if&lt;BR&gt;end if&lt;BR&gt;next&lt;/P&gt;
&lt;P&gt;if(cint(string1)&amp;lt;=cint(string3) and cint(string3)&amp;lt;=cint(string2)) then&lt;BR&gt;checkiprange=1&lt;BR&gt;else&lt;BR&gt;checkiprange=0&lt;BR&gt;end if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;checkiprange=0&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;else&lt;BR&gt;checkiprange=0&lt;BR&gt;end if&lt;BR&gt;end function&lt;/P&gt;
&lt;P&gt;sub helpfile()&lt;/P&gt;
&lt;P&gt;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;set help = fso.OpenTextFile("help.txt")&lt;/P&gt;
&lt;P&gt;do while not help.atendofstream&lt;/P&gt;
&lt;P&gt;wscript.echo (help.readline)&lt;/P&gt;
&lt;P&gt;loop&lt;/P&gt;
&lt;P&gt;end sub&lt;/P&gt;
&lt;P&gt;' this function will return 1 if the scope(scopestr) is present in the given server(serverarray....this is an array of server scopes)(be it source or destination)...else 0&lt;/P&gt;
&lt;P&gt;function isscope(scopestr,serverarray)&lt;/P&gt;
&lt;P&gt;l=0&lt;BR&gt;for i=0 to ubound(serverarray)&lt;BR&gt;if(strcomp(scopestr,serverarray(i))=0) then&lt;BR&gt;l=1&lt;BR&gt;exit for&lt;BR&gt;end if&lt;BR&gt;next&lt;/P&gt;
&lt;P&gt;isscope=l&lt;/P&gt;
&lt;P&gt;end function&lt;/P&gt;
&lt;P&gt;'this function will check if the server entered as argument is present or not(or rather entered correctly or not)&lt;/P&gt;
&lt;P&gt;function checkserver(str1)&lt;BR&gt;dim wshell&lt;/P&gt;
&lt;P&gt;dim pos1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set wshell = CreateObject("WScript.Shell") &lt;BR&gt;&amp;nbsp;set obj = wshell.exec("netsh dhcp server "&amp;amp;str1&amp;amp;" show scope")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;scopes = obj.stdout.readall()&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;pos1=instr(scopes,"Command completed successfully.")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'if the string is present, the command has executed succesfully&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;if(pos1&amp;lt;&amp;gt;0) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;checkserver=1&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;checkserver=0&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;end function&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;'this function takes as argument the output string that we get after the command show scope is executed and returns &lt;BR&gt;'the array of all scopes present in the server&lt;/P&gt;
&lt;P&gt;function makescopearray(scopes)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set scopefile = fso.CreateTextFile("scopefile.txt")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;scopefile.writeline(scopes)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'writing output string to a file&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;scopefile.close&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set scopefile = fso.OpenTextFile("scopefile.txt")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;do While not scopefile.AtEndOfStream&amp;nbsp;&amp;nbsp;&amp;nbsp;'reading line by line and checking for the string "Total No. of Scopes"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;line = scopefile.ReadLine&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(instr(line,"Total No. of Scopes")=2) then&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;str = split(line)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;t=str(ubound(str)-1)&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'taking no. of scopes into t&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit do&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;loop&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;scopefile.close&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;t=cint(t)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'converting string to integer&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if t=0 then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'if no scopes are present &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;makescopearray=""&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Set scopefile = fso.OpenTextFile("scopefile.txt")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for i=1 to 5&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;scopefile.skipline&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'skipping first five lines &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;next&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for i=0 to t-1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;str3=trim(scopefile.readline)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;str3 = split(str3," ")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;redim preserve serverscope(i)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;serverscope(i)=str3(0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'adding scopes to array serverscope&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;next &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;makescopearray = serverscope&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'returning the array to calling function&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;scopefile.close&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;end function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'function to take reservations from source server and add to destination server for a given scope&lt;/P&gt;
&lt;P&gt;sub reservedip(sourceadd,destadd,scopestr,filename,command)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;dim outp&lt;BR&gt;&amp;nbsp;set wshell = CreateObject("WScript.Shell") &lt;BR&gt;&amp;nbsp;set obj = wshell.exec("netsh dhcp server "&amp;amp;sourceadd&amp;amp;" scope " &amp;amp;scopestr&amp;amp; " show reservedip" )&lt;BR&gt;&amp;nbsp;outpsource = obj.stdout.readall()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;call makeipandmacarray(outpsource)&lt;BR&gt;&amp;nbsp;iparraysource = iparray&lt;BR&gt;&amp;nbsp;macarraysource = macarray&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;if(not isarray(iparraysource)) then&lt;BR&gt;&amp;nbsp;wscript.echo "no reservations in the scope "&amp;amp;scopestr&amp;amp;" on the server "&amp;amp;sourceadd &lt;BR&gt;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if(m=1 or m=2) then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;&amp;nbsp;Set outfile = fso.openTextFile(filename,8)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;for i=0 to ubound(iparraysource)&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;outfile.writeline("netsh dhcp server "&amp;amp;destadd&amp;amp; " scope " &amp;amp;scopestr&amp;amp; " add reservedip " &amp;amp;iparraysource(i)&amp;amp; " " &amp;amp; macarraysource(i))&lt;BR&gt;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;outfile.close&lt;BR&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;call addreservation(destadd,scopestr,iparraysource,macarraysource)&lt;/P&gt;
&lt;P&gt;'now finaliparray and finalmacarray contain only the unique ip and mac addresses&lt;/P&gt;
&lt;P&gt;if (not isarray(finaliparray) or finaliparray(0)="") then&lt;BR&gt;if ((m=1 or m=2)) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (strcomp(command,"-migrate")=0 or (strcomp(command,"-sync")=0 and synccount=1)) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo"output is in file "&amp;amp;filename&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&amp;nbsp;&lt;BR&gt;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;t=ubound(finaliparray)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;set wshell = CreateObject("WScript.Shell") &lt;BR&gt;&amp;nbsp;&amp;nbsp;for i=0 to t&lt;BR&gt;&amp;nbsp;&amp;nbsp;set obj = wshell.exec("netsh dhcp server "&amp;amp;destadd&amp;amp;" scope " &amp;amp;scopestr&amp;amp; " add reservedip " &amp;amp;finaliparray(i)&amp;amp; " " &amp;amp; finalmacarray(i))&lt;BR&gt;&amp;nbsp;&amp;nbsp;outp = &amp;nbsp;obj.stdout.readall()&lt;BR&gt;&amp;nbsp;&amp;nbsp;if(instr(outp,"Command completed successfully.")) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "added reservation "&amp;amp;finaliparray(i)&amp;amp; " "&amp;amp;finalmacarray(i)&amp;amp;" to server "&amp;amp;destadd&amp;amp;" in scope "&amp;amp;trim(scopestr)&lt;BR&gt;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "The specified IP address "&amp;amp;finaliparray(i)&amp;amp; " or hardware address "&amp;amp; finalmacarray(i)&amp;amp; " is being used by another client."&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;if ((m=1 or m=2)) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (strcomp(command,"-migrate")=0 or (strcomp(command,"-sync")=0 and synccount=1)) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo"output is in file "&amp;amp;filename&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&amp;nbsp;&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;end sub&lt;/P&gt;
&lt;P&gt;sub makeipandmacarray(outp)&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;redim iparray(0)&lt;BR&gt;&amp;nbsp;redim macarray(0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;&amp;nbsp;Set scopefile = fso.CreateTextFile("scopefile.txt")&lt;BR&gt;&amp;nbsp;scopefile.writeline(outp)&lt;BR&gt;&amp;nbsp;scopefile.close&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;Set scopefile = fso.openTextFile("scopefile.txt")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;do While not scopefile.AtEndOfStream&lt;BR&gt;&amp;nbsp;line = scopefile.ReadLine&lt;BR&gt;&amp;nbsp;if(instr(line,"No of ReservedIPs")=1) then&lt;BR&gt;&amp;nbsp;str = split(line)&lt;BR&gt;&amp;nbsp;t=str(4)&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'taking no. of reservations into t&lt;BR&gt;&amp;nbsp;exit do&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;loop&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;scopefile.close&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;if t=0 then&lt;BR&gt;&amp;nbsp;iparray = ""&lt;BR&gt;&amp;nbsp;macarray = ""&lt;BR&gt;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;Set scopefile = fso.openTextFile("scopefile.txt")&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;for i=1 to 7&lt;BR&gt;&amp;nbsp;scopefile.skipline&lt;BR&gt;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;for i=1 to t&lt;BR&gt;&amp;nbsp;redim preserve iparray(i-1)&lt;BR&gt;&amp;nbsp;redim preserve macarray(i-1)&lt;BR&gt;&amp;nbsp;string1=split(trim(scopefile.readline))&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;iparray(i-1)=string1(0)&lt;BR&gt;&amp;nbsp;macarray(i-1)=replace(string1(ubound(string1)),"-","")&lt;BR&gt;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;scopefile.close&lt;BR&gt;&amp;nbsp;&lt;BR&gt;end sub&lt;/P&gt;
&lt;P&gt;sub migrate(str1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;if ubound(str1)&amp;lt;4 then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' ensures that the command entered has required no. of arguments&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wscript.echo "Error: unrecongnized or incomplete command line."&lt;BR&gt;&amp;nbsp;&amp;nbsp;call helpfile()&lt;BR&gt;&amp;nbsp;&amp;nbsp;argerror=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;dim k&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;k = checkserver(str1(2))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'checking if the source server exists or not...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'or if they are entered correct or not&lt;BR&gt;&amp;nbsp;&amp;nbsp;if k=0 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "server "&amp;amp;str1(2)&amp;amp; " not present or is entered wrongly"&lt;BR&gt;&amp;nbsp;&amp;nbsp;argerror=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;scopes1 = scopes&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;k = checkserver(str1(3)) &amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;if k=0 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;wscript.echo "server "&amp;amp;str1(3)&amp;amp; " not present or is entered wrongly"&lt;BR&gt;&amp;nbsp;&amp;nbsp;argerror=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;scopes2 = scopes&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;'comes here if both servers are entered correctly&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;sourcescope = makescopearray(scopes1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'sourcescope here has all scopes from source server&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(isarray(sourcescope)) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'checking if there are any scopes in source server &amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;wscript.echo "no scopes present on server "&amp;amp;str1(2)&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;argerror=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;bound=ubound(str1)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(strcomp(str1(4),"all")=0) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'checking if the option "all" is entered &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(bound&amp;gt;4 and bound&amp;lt;7) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(strcomp(str1(5),"-preview")&amp;lt;&amp;gt;0) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;argerror=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wscript.echo "Error: unrecongnized or incomplete command line."&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;call helpfile()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(bound=6) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filename = str1(6)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m=2&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m=1 &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filename = "output.txt"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m=0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;scope=sourcescope&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'scope array now contains all the scopes from source server&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(strcomp(str1(bound),"-preview")=0) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filename = "output.txt"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else if(strcomp(str1(bound-1),"-preview")=0) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m=2&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filename = str1(bound)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m=0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;p=0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for i = 4 to ubound(str1)-m&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'this is the case when scopes are entered as arguments&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(isscope(str1(i),sourcescope)) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'checking if the given scope is present in source server&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;redim preserve scope(p)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'if present then add the scope entered to the array 'scope'&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;scope(p)=str1(i)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;p=p+1&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(synccount=0) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'if the scope entered is not present in the source server&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;wscript.echo "scope "&amp;amp;str1(i)&amp;amp; " is not present in the server "&amp;amp;str1(2)&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;next&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;erase sourcescope&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'freeing the space allocated to sourcescope&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(not isarray(scope)) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'checking if the scope array has some scopes or not&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;argerror=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;destscope = makescopearray(scopes2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'destscope has all scopes from destination server&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(isarray(destscope)) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'checking if there are scopes present on destination server&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;wscript.echo "no scopes present on server "&amp;amp;str1(3)&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;argerror=1&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;exit sub&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;if(m=1 or m=2) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(synccount=0) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;set fso = createobject("Scripting.FileSystemObject")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;set outfile = fso.createtextfile(filename)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;outfile.close&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for i=0 to ubound(scope)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(isscope(scope(i),destscope)) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'checking if scopes are present on destination server or not &amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;call reservedip(str1(2),str1(3),scope(i),filename,str1(1)) 'this will take reservations in the given scope from source server and output add reservedip(destination) command to a file&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wscript.echo "scope "&amp;amp;scope(i)&amp;amp; " not present in server "&amp;amp;str1(3)&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;next&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (m=1 or m=2) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(strcomp(str1(1),"-migrate")=0 or (strcomp(str1(1),"-sync")=0 and synccount=1)) then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;wscript.echo"output is in file "&amp;amp;filename&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;&amp;nbsp;&amp;nbsp;end if&lt;BR&gt;end sub&lt;/P&gt;
&lt;P&gt;X-----------------------End Paste---------------------X&lt;/P&gt;
&lt;P&gt;And here is a more formal looking help: &lt;BR&gt;USAGE:&lt;BR&gt;&amp;nbsp; Rmanager&amp;nbsp; /? &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -migrate &amp;lt;source server&amp;gt; &amp;lt;destination server&amp;gt; &amp;lt;all|&amp;lt;list of scopes&amp;gt;&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;[-preview [filename]]&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -sync &amp;lt;server1&amp;gt; &amp;lt;server2&amp;gt; &amp;lt;all | &amp;lt;list of scopes&amp;gt;&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;[-preview [filename]]&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -dumplease &amp;lt;filename&amp;gt; &amp;lt;server&amp;gt; &amp;lt;all | &amp;lt;listof scopes&amp;gt;&amp;gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -makereservation &amp;lt;server&amp;gt; &amp;lt;filename&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Options:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; display this help message&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -migrate &amp;nbsp;&amp;nbsp;&amp;nbsp; copies reservations from all or the specified &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; scopes from source to destination server...if &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; preview is specified, it shows the commands that &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; will be executed, in the output file&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -sync&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; synchronises reservations between two servers for &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; all or the specified scopes....if preview is &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; specified, it shows the commands that will be &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; executed, in the output file&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -dumplease&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputs the ip and macaddresses of all clients in &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the given server for the given scopes&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -makereservation&amp;nbsp;&amp;nbsp;&amp;nbsp; adds reservations for the ip and mac address pairs &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from the given file into the given server&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;Examples:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; cscript rmanager.vbs Rmanager -migrate 120.0.0.1 120.0.0.2 all&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;....copies reservations in all scopes from server 120.0.0.1 &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to server 120.0.0.2&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; cscript rmanager.vbs&amp;nbsp;Rmanager -sync 120.0.0.1 120.0.0.2 120.0.0.0 &lt;BR&gt;&amp;nbsp;&amp;nbsp;....synchronises reservations between the two servers &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 120.0.0.1 and 120.0.0.2 for the scope 120.0.0.0&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; cscript rmanager.vbs Rmanager -dumplease out.txt 120.0.0.1 all&lt;BR&gt;&amp;nbsp;&amp;nbsp;...dumps all clients' ip and mac addresses into out.txt&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt; cscript rmanager.vbs Rmanager -makereservation 120.0.0.1 out.txt&lt;BR&gt;&amp;nbsp;&amp;nbsp;...takes ip and mac address pairs from the file out.txt and &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; makes reservation on the server 120.0.0.1&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you feel this tool is great, then don't thank me. Rather thank &lt;STRONG&gt;Amit Mirchandani&lt;/STRONG&gt; who is an intern working with us.. :-)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=714685" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>How to find out how many more addresses are available in the DHCP server?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2006/03/17/553525.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2006/03/17/553525.aspx</id><published>2006-03-17T10:30:00Z</published><updated>2006-03-17T10:30:00Z</updated><content type="html">

&lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;I got a couple of questions from a
collegue regarding configuring DHCP server from a client machine. Before you
can configure the DHCP server from a client machine like XP through netsh or
MMC, you need to install something. Please refer: &lt;a href="../../anto_rocks/archive/2005/04/05/405511.aspx%20"&gt;&lt;span style="color: windowtext;"&gt;http://blogs.msdn.com/anto_rocks/archive/2005/04/05/405511.aspx
&lt;/span&gt;&lt;/a&gt;&lt;br&gt;
Now coming to the questions:&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;1)&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;from a client side, I would like to check if the server has additional
leases. &lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;a.&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;assume that the client doesn’t have admin privilege to the DHCP server&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;[AntoAMJ]:
If the client does not have the admin/user priveledge to configure the DHCP
server, then the only way to determine whether the server has additional leases
is to send a DHCP DISCOVER packet and waiting for a DHCP OFFER to come. If the
DHCP OFFER has a valid address, then the server has additional leases. To make
sure that the DHCP server does not commit the lease to this client, abstain
from sending the DHCP REQUEST in response to the OFFER. This way the address
which is given to the client will be reclaimed automatically. Care must be
taken so that an artificial MAC address is put into the DISCOVER so that the
DHCP server does not identify this request to the actual client but treats it
as a new client. This is needed if the client has already an valid lease from
the same DHCP server. This is a proper hack. Don’t do this unless you are
desperate. Moreover you won’t be able to find the no of free addresses this way.&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&lt;/u2:p&gt;b.&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;assume that the client has admin privilege to the dhcp server&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;[AntoAMJ]:
If the client has admin/user priveldge to configure the DHCP server, then the
best way to find out the number of additional leases (free addresses) in a
given scope in a given DHCP server is throught the netsh command netsh dhcp
server show mibinfo. This command will print the number of available leases for
every scope in the DHCP server. &lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&lt;/u2:p&gt;2)&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;from a client side, I would like to release a lease (or delete the
client’s lease)&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;a.&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;assume that the client doesn’t have admin privilege to the DHCP server&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormalIndent" style="text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;[AntoAMJ]: The client does not need admin priviledge to the
DHCP server to release its own lease. All it needs to do is call the ipconfig
/release.&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&lt;u2:p&gt;&lt;/u2:p&gt;&amp;nbsp;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;b.&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;assume that the client has admin privilege to the dhcp server&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormalIndent" style="text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&amp;nbsp;[AntoAMJ]: The client does not need admin priviledge
to the DHCP server to release its own lease. All it needs to do is call the
ipconfig /release.&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&lt;u2:p&gt;&lt;/u2:p&gt;&amp;nbsp;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&amp;nbsp;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&amp;nbsp;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;3)&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;from a client side, delete a lease on the dhcp server that the client
doesn’t own&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;a.&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;assume that the client doesn’t have admin privilege to the DHCP server&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormalIndent" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;[AntoAMJ]: Send the DHCP RELEASE packet on behalf of the
client. Create your own release packet with the MAC address of the client whose
lease has to be deleted. This is also a hack. Don’t do this unless you are
desperate.&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&lt;u2:p&gt;&lt;/u2:p&gt;&amp;nbsp;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;b.&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;assume that the client has admin privilege to the dhcp server&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormalIndent" style="text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;[AntoAMJ]: The best bet for you is call the netsh command
netsh dhcp server delete lease.&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&lt;u2:p&gt;&lt;/u2:p&gt;&amp;nbsp;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u2:p&gt;&amp;nbsp;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;4)&lt;span style="font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;from a client side, discover if there is a dhcp server on the subnet&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;[AntoAMJ]:
Send a DISCOVER and wait for OFFERS to come. If there are any DHCP server which
are servincing the subnet, then that many OFFER’s will come to the client. In
fact if I remember correctly, there was a tool called dhcploc.exe which does
this automatically for you. &lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;DhcpLoc.exe
Documentation: &lt;a href="http://technet2.microsoft.com/WindowsServer/en/Library/8fa42e83-ec08-4a9b-9057-8909f7ed433e1033.mspx"&gt;&lt;span style="color: windowtext;"&gt;http://technet2.microsoft.com/WindowsServer/en/Library/8fa42e83-ec08-4a9b-9057-8909f7ed433e1033.mspx&lt;/span&gt;&lt;/a&gt;
&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-left: 1in;"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;DhcpLoc.exe
Download: &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&amp;amp;displaylang=en"&gt;&lt;span style="color: windowtext;"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&amp;amp;displaylang=en&lt;/span&gt;&lt;/a&gt;
&lt;u2:p&gt;&lt;/u2:p&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u1:p&gt;&lt;br style=""&gt;
&lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br style=""&gt;
&lt;!--[endif]--&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;



&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=553525" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>How to programatically set/view the DNS settings.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2006/03/06/544323.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2006/03/06/544323.aspx</id><published>2006-03-06T10:23:00Z</published><updated>2006-03-06T10:23:00Z</updated><content type="html">&lt;font face="Arial" size="2"&gt;How to programmactically set/view the DNS settings that we set in the DNS tab of the Server/Scope/Reservation property page?&lt;br&gt;&lt;br&gt;Before we investigate how to retrieve this information, let me first explain to you that this information is persisted as a DHCP standard option. The option number that is using is option number 81. Having said that since the DHCP server is using an option number to persist this information, it does not send this information to the client, when the client requests for it. Rather this 81 option is treated as a special option which is used only for persisting the configuration information. The following is how this information is encoded into the option 81.&lt;br&gt;&lt;br&gt;Option 81 is a DWORD:&lt;br&gt;&lt;br&gt;1st bit set to '1' if the Check box "Enable DNS Dynamic updates according to settings below" is selected (If this bit is off (as in the case of the screenshot), all other possibilities are ruled out which case the value of the option will always be 0).&lt;br&gt;&lt;br&gt;2nd bit set to '1' if "Dynamically update DNS A and PTR records for DHCP clients that do not request updates (for example, clients running Windows NT 4.0).&lt;br&gt;&lt;br&gt;3rd bit set to '1' if Check box "Discard A and PTR records when lease is deleted' is selected&lt;br&gt;&lt;br&gt;5th bit To choose between 'Dynamically update DNS A and PTR records only if requested by DHCP clients/" (value of 5th bit = '0') And "Always dynamically update DNS A and PTR records" (value of 5th bit = '1')&lt;br&gt;&lt;br&gt;To double check the encoding, play arround with the various check boxes in the DNS-Scope UI and see the reflected change in the scope option by typing show optionvalue at the scope level.&lt;br&gt;&lt;br&gt;There are two ways to get the required information programmatically:&lt;br&gt;&lt;br&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using the API DhcpGetOptionValue. This is a public function which can be called. (The option id is 81)&lt;br&gt;&lt;br&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We can also use the netsh command to get this information: Eg netsh dhcp server show optionvalue 81&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=544323" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>How to override the system default for the threshold for the event 1020.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/11/02/488033.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/11/02/488033.aspx</id><published>2005-11-02T08:01:00Z</published><updated>2005-11-02T08:01:00Z</updated><content type="html">&lt;SPAN class=919560008-24102005&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" color=#000000 size=3&gt;Question: How can I change the threshold value for firing of event 1020. Event 1020 fired by the DHCP server is fired whenever the amount of free addresses in a scope is less than 80%.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" color=#000000 size=3&gt;E.g:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT color=#000000&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY: Arial"&gt;Event Type: &amp;nbsp; &amp;nbsp; Warning &lt;BR&gt;Event Source: &amp;nbsp; DhcpServer &lt;BR&gt;Event Category: None &lt;BR&gt;Event ID: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; 1020 &lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY: Arial"&gt;&lt;BR&gt;&lt;FONT color=#000000&gt;Date: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3/08/2005 &lt;BR&gt;Time: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 19:50:48 &lt;BR&gt;User: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N/A &lt;BR&gt;Computer: &amp;nbsp; &amp;nbsp; &amp;nbsp; NETSERVER &lt;BR&gt;Description: &lt;BR&gt;Scope, 10.156.32.0, is&lt;/FONT&gt;&lt;SPAN style="COLOR: red"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;B&gt;&lt;SPAN style="COLOR: red; FONT-FAMILY: Arial"&gt;81&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY: Arial"&gt;&lt;FONT color=#000000&gt;percent full with only 35 IP addresses remaining.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" color=#000000 size=3&gt;For some people they might want to change this threshold value of 80%. For them firing this warning at 90% might make more sense of it the threshold could be lower that 80%. For these purposes, to override the system default of 80%, what can I do?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=919560008-24102005&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;Answer:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class=919560008-24102005&gt;&lt;FONT face=Arial color=#0000ff size=2&gt;I believe there is indeed a registry key which can override the default threshold for logging event 1020. &lt;STRONG&gt;The reg key is named "DhcpAlertPercentage" and is of type REG_DWORD.&lt;/STRONG&gt; You can create it under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dhcpserver\Parameters. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=488033" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>About "Default Routing and Remote Access Class"</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/11/02/488030.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/11/02/488030.aspx</id><published>2005-11-02T07:55:00Z</published><updated>2005-11-02T07:55:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The following is a question i received from one of the internal groups and my answer to the same. I hope you find the information usefull.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Question:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I am trying to configure options to be applied specifically to workstations that make a vpn connection. The workstations appear to get&amp;nbsp;all options that are set on the dhcp server as long as they are "Default User Class" options but as soon as I set an option to "Default Routing and Remote Access Class" the workstations no longer get the options.&lt;/SPAN&gt;&amp;nbsp;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I have run the command on the client "ipconfig /setclassid test "Default Routing and Remote Access Class" where test is the name of the vpn connectoid.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The client gets an ip address and the ipconfig output even shows "DHCP Class ID: Default Routing and Remote Access Class" but it still fails to get the options. &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I even moved the client to the local lan and set the class on the NIC to rule out RRAS but still don't get the options applied. &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In my tests, Windows 2003 DHCP is not assigning options based on the clients class-id of "Default Routing and Remote Access Class".&lt;/SPAN&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Can a client have multiple classes? &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Does it send all classes in a DHCP&amp;nbsp;inform?&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;If so, how does DHCP determine which class to select from?&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;If I change the class-id on a client to be "Default Routing and Remote Access Class" so that I can set specific options on the machine when it is in the field, must I remove or change that class on the workstation when it returns to the LAN?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;Answer:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;Let me clarify first of all that the class "Default Routing and Remote Access Class" is a predefined user class meant to used as a way to identify clients which are getting network access using VPN. These clients first talk to the VPN server to get connectivity. The VPN server tries to get the ip address for the remote client by talking to the DHCP server. The DHCP server assigns the VPN server set of addresses from which the VPN server assigns to the remote clients. Now that the remote client gets an IP address, it tries to get all other configuration information directly from the DHCP server through DHCP INFORM packets. When the DHCP server recieves the INFORMS from such remote clients, it identifies that these clients are belonging to the "Default Routing and Remote Access Class" through an internal mechanism and it picks up the configuration present under the class "Default Routing and Remote Access Class". This is how &lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;this user class &lt;/SPAN&gt;&lt;/STRONG&gt;is meant to be used.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;Regarding your other specific questions:&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;Can a client have multiple classes?&amp;nbsp; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;No. It can have atmost one user class and one vendor class. If it does not have a expliclty defined user/vendor class, it is assumed to belong to the Default User/Vendor class.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;Does it send all classes in a DHCP&amp;nbsp;inform?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;: NA. See answer to previous question.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;If so, how does DHCP determine which class to select from?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;: NA. See answer to previous question.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;If I change the class-id on a client to be "Default Routing and Remote Access Class" so that I can set specific options on the machine when it is in the field, must I remove or change that class on the workstation when it returns to the LAN?: &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;First of all when you mention "Default Routing and Remote Access Class" as mentioned in the UI of the DHCP server, you are referring to the display name of the user class. This is not what you would see if you parse the user class information of the DHCP packet. The actual byte sequence which represents&amp;nbsp;this user class, can be quite different. Whereas, when you mention the user class in the ipconfig /setclassid command, what you are mentioning is the actual byte string that will be put into the user class field in the DHCP packet by the DHCP client when sending the requests. You should not attempt to use upconfig /setclassid to set the user class of the clients and use the name of the predefined User classes. When you want to assign specific set of clients specific config, you might want to create a new user class and configure that in the dHCP server and on the client using ipconfig /setclassid.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;I hope i have cleared your doubts... Let me know if you have any further issues.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;Interaction between DHCP and RRAS (VPN):&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;&lt;A title=http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/ServerHelp/8e9004b2-1153-4202-89e2-b7f0a9c7f8a4.mspx href="http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/ServerHelp/8e9004b2-1153-4202-89e2-b7f0a9c7f8a4.mspx"&gt;http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/ServerHelp/8e9004b2-1153-4202-89e2-b7f0a9c7f8a4.mspx&lt;/A&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A title=http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef/8006f246-2029-4bad-b9f0-4f31a56b0590.mspx href="http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef/8006f246-2029-4bad-b9f0-4f31a56b0590.mspx"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef/8006f246-2029-4bad-b9f0-4f31a56b0590.mspx&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&amp;nbsp;Please refer the section on &lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;"DHCP and Routing and Remote Access"&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;A title=http://support.microsoft.com/kb/160699/ href="http://support.microsoft.com/kb/160699/"&gt;http://support.microsoft.com/kb/160699/&lt;/A&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial"&gt;General discussion about user/vendor classes:&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;A title=http://blogs.msdn.com/anto_rocks/archive/2005/02/25/380231.aspx href="/anto_rocks/archive/2005/02/25/380231.aspx"&gt;http://blogs.msdn.com/anto_rocks/archive/2005/02/25/380231.aspx&lt;/A&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=488030" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>Follow-up article on DHCP server callout DLL.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/05/24/421353.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/05/24/421353.aspx</id><published>2005-05-24T10:33:00Z</published><updated>2005-05-24T10:33:00Z</updated><content type="html">&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I got a VS.NET solution for the sample DHCP server callout DLL. I have shared it to the world here: &lt;A href="http://www.geocities.com/anto_rocks/DHCPCalloutDL.zip"&gt;http://www.geocities.com/anto_rocks/DHCPCalloutDL.zip&lt;/A&gt;. Please let me know of any copyright issues as i do not know who wrote this code. I suppose this will work as i did not test it out myself. I just got it from my colleague.&lt;/P&gt;
&lt;P&gt;Thanks, A.J.Anto&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=421353" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>Windows 2003 SP1 DHCP export/import netsh commands failure on IA64 platform</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/05/17/418464.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/05/17/418464.aspx</id><published>2005-05-17T09:42:00Z</published><updated>2005-05-17T09:42:00Z</updated><content type="html">&lt;P&gt;Hi all,&lt;BR&gt;&amp;nbsp;This post is regarding an issue that plagues the Windows Server 2003 SP1 on Itanium 64 platforms. The problem is that the netsh export/import commands fail on these cases with the following error:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000000&gt;&lt;STRONG&gt;DHCP Server import and export are allowed on local servers only.&lt;BR&gt;DHCP Server export failed.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;There is a simple work arround for this problem:&lt;BR&gt;We need to write a small text file, let's call it test.nsh with the following contents:&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;show bindings&lt;BR&gt;export c:\test.txt all&lt;/STRONG&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;and on the command prompt type &lt;FONT face="Courier New" color=#0000ff&gt;&lt;STRONG&gt;netsh -f test.nsh&lt;/STRONG&gt;&lt;/FONT&gt;. Similarly the import command can also be executed. &lt;/P&gt;
&lt;P&gt;This problem does not occur in other platforms.&lt;BR&gt;Please feel free to contact me if you have happen to come across any other problem with Windows Server 2003 SP1.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=418464" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>Follow-up article on how to set lease times through netsh.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/05/11/416381.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/05/11/416381.aspx</id><published>2005-05-11T11:54:00Z</published><updated>2005-05-11T11:54:00Z</updated><content type="html">&lt;P&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt; &lt;SPAN&gt;I have a customer that has 5 DHCP servers that host many scopes. The customer wants to know of a way to script changing the lease duration on the advanced page of the properties of the scope (because they also have Bootp clients). Anybody have any ideas on how to script this change? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;netsh dhcp server scope 10.0.0.0 set optionvalue 51 DWORD user=”Default BOOTP Class”&amp;nbsp; 3600&lt;/STRONG&gt;&lt;/EM&gt; is your babe! For a detailed explanation please refer to my previous post on &lt;A id=_ctl0__ctl0__ctl0__ctl0_RecentPosts__ctl0_postlist__ctl0_EntryItems__ctl4_PostTitle HREF="/anto_rocks/archive/2005/03/28/402862.aspx"&gt;&lt;FONT color=#009933&gt;How to set DHCP scope lease time through netsh?&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=416381" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>A very good article on DHCP technology.</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/04/07/406138.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/04/07/406138.aspx</id><published>2005-04-07T11:51:00Z</published><updated>2005-04-07T11:51:00Z</updated><content type="html">&lt;P&gt;Hi all, The person (Balint Toth) who gave the contents of the previous post pointed out this link. This&amp;nbsp;link really good description of the DHCP technology. A must read i must say: &lt;A href="http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef/8006f246-2029-4bad-b9f0-4f31a56b0590.mspx"&gt;http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef/8006f246-2029-4bad-b9f0-4f31a56b0590.mspx&lt;/A&gt; Thanks a lot Balint Toth!&lt;/P&gt;
&lt;P&gt;Btw, If any body finds out an interesting peice of information (This can be anything from a documentation link to a sample code.) regarding DHCP technology especially with respect to Microsoft's implementation of it and want to contribute to this blog, please contact me at &lt;A href="mailto:anto_rocks@yahoo.co.in"&gt;anto_rocks@yahoo.co.in&lt;/A&gt; I will put it on my blog so that it is available for wider audience.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=406138" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>What it takes to get a lease.........</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/04/06/405955.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/04/06/405955.aspx</id><published>2005-04-06T20:53:00Z</published><updated>2005-04-06T20:53:00Z</updated><content type="html">&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;I found this pretty useful content in one of our internal DL's. I thought it should be available more widely.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;The following describes what it takes to get a address lease from the DHCP client. It describes the various steps taken by the DHCP client in various circumstances.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;1. The DHCP client requests an IP address by broadcasting a DHCPDiscover message to the local subnet.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;2. The client is offered an address when a DHCP server responds with a DHCPOffer message containing an IP address and configuration information for lease to the client. If no DHCP server responds to the client request, the client sends DHCPDiscover messages at intervals of 0, 4, 8, 16, and 32 seconds, plus a random interval of between -1 second and 1 second. If there is no response from a DHCP server after one minute, the client can proceed in one of two ways: &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;If the client is using the Automatic Private IP Addressing (APIPA) alternate configuration, the client self-configures an IP address for its interface. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;If the client does not support alternate configuration, such as APIPA, or if IP auto-configuration has been disabled, the client network initialization fails. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;In both cases, the client begins a new cycle of DHCPDiscover messages in the background every five minutes, using the same intervals as before (0, 4, 8, 16, and 32 seconds), until it receives a DHCPOffer message from a DHCP server.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;3. The client indicates acceptance of the offer by selecting the offered address and broadcasting a DHCPRequest message in response. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;4. The client is assigned the address and the DHCP server broadcasts a DHCPAck message in response, finalizing the terms of the lease.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;When the client receives acknowledgment, it configures its TCP/IP properties by using the DHCP option information in the reply, and completes its initialization of TCP/IP. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;5. In rare cases, a DHCP server might return a negative acknowledgment to the client. This can happen if a client requests an invalid or duplicate address. If a client receives a negative acknowledgment (DHCPNack), the client must begin the entire lease process again.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=405955" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>Manage your server from your desktop!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/04/05/405511.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/04/05/405511.aspx</id><published>2005-04-05T12:00:00Z</published><updated>2005-04-05T12:00:00Z</updated><content type="html">&lt;P class=MsoNormal&gt;In this post, I am going to talk about an interesting way to manage your Windows Servers. One of the things that would certainly be a good thing to have is the freedom to use your desktop environment to monitor and configure your servers. The advantages of the above method are the following:&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;1)&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;General Ease of configuration: Sometimes it is difficult to physically reach the actual server you want to configure. I know the dhcp-mmc snap-in can remotely configure a DHCP server but the problem is that you need to get your hands on a Win2k3 server machine to do this. &lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;2)&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Reliability: When you monitor your servers from your desktop or other server machines you make sure that you cause the least disturbance on the target server. That is the extra load of running the management application is removed from the DHCP server.&lt;/P&gt;
&lt;P class=MsoNormal&gt;Now for the part which actually explains how to get to a state when you can use your desktop to configure and monitor the DHCP server. I won’t go into details of it as it has been clearly documented here: &lt;A href="http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/ServerHelp/4dacb61b-7ddc-49be-a244-9ad70634f6bb.mspx"&gt;How to install adminpak to configure DHCP server from your Desktop.&lt;/A&gt;&amp;nbsp;Here is the download link: &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c16ae515-c8f4-47ef-a1e4-a8dcbacff8e3&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=c16ae515-c8f4-47ef-a1e4-a8dcbacff8e3&amp;amp;displaylang=en&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;The installation will pull in all the binaries which are needed for remote configuration and management of the Windows server. Primarily these are the MMC-snap-ins for the various windows services. After the installation you can immediately test your new setup by doing the following:&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;1)&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Type mmc.exe in the run command window.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;2)&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Click File-&amp;gt;Add Remove Snap-in and select dhcpmgmt.msc&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;3)&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;If everything went well you would be seeing a DHCP console similar to the one you see on your server. From here you can do all the operations you want to do.&lt;/P&gt;
&lt;P class=MsoNormal&gt;If you want to use the netsh command-line interface to configure your DHCP server then you need to do the following:&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;1)&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;First open a command prompt.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;2)&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Type netsh add helper dhcpmon.dll This command will formally install the netsh dhcp helper dll which would have already been pulled to system32 as a part of the install process.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;3)&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;If everything goes fine, you should be able to manage your DHCP server from the netsh interface as well.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=405511" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>Win2K3 SP1 RTM's</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/04/01/404537.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/04/01/404537.aspx</id><published>2005-04-01T17:11:00Z</published><updated>2005-04-01T17:11:00Z</updated><content type="html">&lt;p&gt;The best Server OS just got better! &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=22CFC239-337C-4D81-8354-72593B1C1F43&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=22CFC239-337C-4D81-8354-72593B1C1F43&amp;amp;displaylang=en&lt;/a&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The Windows Server 2003 Service Pack1 RTM's.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=404537" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>How to set DHCP scope lease time through netsh?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/03/28/402862.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/03/28/402862.aspx</id><published>2005-03-28T12:00:00Z</published><updated>2005-03-28T12:00:00Z</updated><content type="html">&lt;p&gt;&lt;font face="Tahoma"&gt;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:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Tahoma"&gt;&lt;strong&gt;netsh dhcp server scope 10.0.0.0 set optionvalue 51 DWORD 3600&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Tahoma"&gt;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: &lt;/font&gt;&lt;a href="http://www.faqs.org/rfcs/rfc2132.html"&gt;&lt;font face="Tahoma"&gt;http://www.faqs.org/rfcs/rfc2132.html&lt;/font&gt;&lt;/a&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;DWORD is the datatype of the lease-time option. And finally 3600 represents the option value in number of seconds. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Tahoma"&gt;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&amp;nbsp;I must say....&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=402862" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry><entry><title>How to find out all the active clients serviced by your DHCP server</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/anto_rocks/archive/2005/03/23/401311.aspx" /><id>http://blogs.msdn.com/anto_rocks/archive/2005/03/23/401311.aspx</id><published>2005-03-24T05:51:00Z</published><updated>2005-03-24T05:51:00Z</updated><content type="html">&lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;font face="Tahoma"&gt;In this post, I am going to discuss about the various ways by which you can enumerate all the client leases of the DHCP server. The reasons why you might want to do this can be many:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;font face="Tahoma"&gt;You might want to do this when we want to have a single list of all clients your DHCP server is serving which automatically means that you want to know all the participants in your private LAN’s. You might need this information for administrative or for security reasons. (Let’s say whenever an unauthorized machine joins the network, you want to check it) Another interesting situation is when you want to maintain a database of all active network devices which are getting an IP address from the DHCP server in your favorite database for your own purposes. &lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;font face="Tahoma"&gt;You can do this through the following:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;font face="Tahoma"&gt;1) In the netsh, there is no command to create leases. But there is definitely a command to view the leases. What we need to do is go to each scope context via netsh and type the commands show clients &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;font face="Tahoma"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Netsh dhcp server scope 10.0.0.0 show clients&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;font face="Tahoma"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;font face="Tahoma"&gt;The above command will dump the leases in a human-readable form into the screen. We need to redirect the output to the text file. The information for each lease is represented by IP address, Hardware address and other misc info.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;font face="Tahoma"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;2) &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;Another way is perhaps use the DHCP server management API: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dhcp/dhcp/dhcpenumsubnetclients.asp to enumerate the active leases.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"&gt;&lt;font face="Tahoma"&gt;3) You can also do this from the MMC. This was a little surprising to me the first time I saw as I did not expect the granular data control that was made available. Go to the Address leases of each scope and right-click on the ‘Address Leases’ icon and clieck ‘Export List’ and you can dump the leases to a text file. Later you might want to parse this file (this contains the IP address and hardware address) and store it in your custom format.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=401311" width="1" height="1"&gt;</content><author><name>anto_rocks</name><uri>http://blogs.msdn.com/members/anto_rocks.aspx</uri></author></entry></feed>