<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brad&#039;s Tech Blog &#187; netsh</title>
	<atom:link href="http://bradstechblog.com/tag/netsh/feed" rel="self" type="application/rss+xml" />
	<link>http://bradstechblog.com</link>
	<description>Microsoft technologies like: System Center Operations Manager, and whatever else comes up at the office.</description>
	<lastBuildDate>Sat, 13 Feb 2010 01:59:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Manage multiple DHCP scopes with netsh script</title>
		<link>http://bradstechblog.com/netsh/manage-multiple-dhcp-scopes-with-netsh-script</link>
		<comments>http://bradstechblog.com/netsh/manage-multiple-dhcp-scopes-with-netsh-script#comments</comments>
		<pubDate>Tue, 05 Aug 2008 13:40:38 +0000</pubDate>
		<dc:creator>Brad Hearn</dc:creator>
				<category><![CDATA[DHCP]]></category>
		<category><![CDATA[Microsoft windows server]]></category>
		<category><![CDATA[netsh]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Scopes]]></category>

		<guid isPermaLink="false">http://bradstechblog.com/?p=64</guid>
		<description><![CDATA[Use a script to change the DNS lookups and Wins lookups options in DHCP on muliple scripts. Using the netsh command this can be done eaisly.
Tools needed&#8230;



Some knowledge of the netsh command
A text file with the ip address&#8217;s of the scopes to be modified
IP address&#8217;s of the DHCP servers to change
And a script of course.

The easiest [...]]]></description>
			<content:encoded><![CDATA[<p>Use a script to change the DNS lookups and Wins lookups options in DHCP on muliple scripts. Using the netsh command this can be done eaisly.</p>
<p>Tools needed&#8230;</p>
<p><!-smartads-></p>
<p><span id="more-64"></span></p>
<ol>
<li>Some knowledge of the netsh command</li>
<li>A text file with the ip address&#8217;s of the scopes to be modified</li>
<li>IP address&#8217;s of the DHCP servers to change</li>
<li>And a script of course.</li>
</ol>
<p>The easiest way to obtain the ip address&#8217;s of the scopes to modify is to log onto the DHCP server itself and open your support tools command prompt</p>
<p><strong><span style="text-decoration: underline;">Step 1.</span></strong></p>
<p>Go to <a title="netsh command line" href="http://technet2.microsoft.com/windowsserver/en/library/61427fbd-de1f-4c8a-b613-321f7a3cca6a1033.mspx?mfr=true" target="_blank">netsh command line</a> to understand more on this command. And make sure you create a test subnet to run my scripts agains to make sure this is right for you.</p>
<p><strong></strong></p>
<p><strong><span style="text-decoration: underline;">Step 2.</span></strong></p>
<blockquote><p><em>C:\Program Files\Support Tools&gt;</em><span style="color: #ff0000;">netsh dhcp server 172.x.x.x show scope &gt; c:\scope.txt</span></p></blockquote>
<p>At the command prompt enter the section above in red (insert the ip address of the DHCP server in place of 172.x.x.x. This will create a text file with the sope info on your c drive.</p>
<p> </p>
<p><a href="http://bradstechblog.com/wp-content/uploads/2008/07/image-0316.png"><img class="aligncenter size-medium wp-image-65" title="image-0316" src="http://bradstechblog.com/wp-content/uploads/2008/07/image-0316-300x155.png" alt="" width="300" height="155" /></a></p>
<p> </p>
<p>You will now want to open scope.txt and clean it up. You only want the IP address&#8217;s of the scopes to be changed. the text file should be in the following format</p>
<blockquote><p><strong><span style="text-decoration: underline;"><img class="aligncenter size-medium wp-image-66" title="image-0317" src="http://bradstechblog.com/wp-content/uploads/2008/07/image-0317-281x300.png" alt="" width="205" height="195" /></span></strong></p>
<p><strong></strong> </p></blockquote>
<p><strong><span style="text-decoration: underline;">Step 3</span></strong></p>
<blockquote><p><span style="color: #ff0000;">for /f &#8220;tokens=1&#8243; %%a in (c:\scope.txt) DO netsh dhcp server 172.x.x.x scope %%a set optionvalue 006 IPADDRESS DNS_Address_1 DNS_Address_2 DNS_Adress_3</span></p></blockquote>
<blockquote>
<p style="TEXT-ALIGN: center"><span style="color: #ff0000;">172.x.x.x = Your DHCP server IP address</span></p>
<p style="TEXT-ALIGN: center"><span style="color: #ff0000;">DNS_Address_#= DNS server IP address&#8217;s</span></p>
</blockquote>
<p>Copy the above red text into a text file and save it as scope_edit.bat to the same folder as scope.txt. Run the bat file. This will run through each IP address changing the dns entires. does not append the scope option for DNS it overwrites it. However it will not effect any other options that are currently set.</p>
<blockquote><p>You can now use the same script to change your wins optin by changing optioncalue 006 to optionvalue 044</p></blockquote>
<p> </p>
<p> Good luck <img src='http://bradstechblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p> <br />
<strong></strong> </p>
<p><strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://bradstechblog.com/netsh/manage-multiple-dhcp-scopes-with-netsh-script/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Microsoft DHCP: How to Export and import scopes between DHCP servers</title>
		<link>http://bradstechblog.com/netsh/export-and-inport-dhcp-scopes</link>
		<comments>http://bradstechblog.com/netsh/export-and-inport-dhcp-scopes#comments</comments>
		<pubDate>Thu, 31 Jul 2008 16:02:50 +0000</pubDate>
		<dc:creator>Brad Hearn</dc:creator>
				<category><![CDATA[DHCP]]></category>
		<category><![CDATA[netsh]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Scopes]]></category>
		<category><![CDATA[Spilt Scopes]]></category>

		<guid isPermaLink="false">http://bradstechblog.com/?p=69</guid>
		<description><![CDATA[We are going to use Microsoft&#8217;s Netsh command to export and import DHCP scopes from one server and then import them to another.  We run a split scope on two servers for redundancy. So scope one serves the range 172.0.0.64 to 172.0.0.159 and the second server handles 172.0.0.160 to 172.0.0.255. While I was performing maintenance I [...]]]></description>
			<content:encoded><![CDATA[<p>We are going to use Microsoft&#8217;s Netsh command to export and import DHCP scopes from one server and then import them to another.  We run a split scope on two servers for redundancy. So scope one serves the range 172.0.0.64 to 172.0.0.159 and the second server handles 172.0.0.160 to 172.0.0.255. While I was performing maintenance I noticed that in some cases someone missed the creation of the second half of the scope. So to fix this I am going to run a script that will export the scopes. Then I will run another script to import them on the second server. Make sure after wards to modify the exclusion on the second server to be opposite so that they are not both serving the same half.</p>
<p><!-smartads-><br />
 <span id="more-69"></span></p>
<blockquote><p>note: the import and export command cannot be ran remotely</p>
<p>Replace 198.168.0.10  with your DHCP server IP address</p>
<p>Replace 198.168.1.0 198.168.2.0 198.168.3.0 with the IP scopes that you are exporting and importing.</p>
<p>Export the scopes for the DHCP server 1</p></blockquote>
<p><strong><em>Step 1</em></strong></p>
<ol>
<li>Log on to the server that you are exporting from.</li>
<li>open the command prompt</li>
<li>Run the following command from the command prompt on the DHCP server that have the scopes already created.</li>
</ol>
<blockquote><p>Netsh DHCP server 198.168.0.10 export c:\scope 198.168.1.0 198.168.2.0 198.168.3.0</p></blockquote>
<p><a href="http://bradstechblog.com/wp-content/uploads/2008/07/image-0318.png"><img class="aligncenter size-full wp-image-70" title="image-0318" src="http://bradstechblog.com/wp-content/uploads/2008/07/image-0318.png" alt="" width="500" height="109" /></a><a href="http://bradstechblog.com/wp-content/uploads/2008/07/image-0318.png"></a></p>
<p> </p>
<p><strong>Step 2</strong></p>
<p>Import the scopes to DHCP server 2  </p>
<ol>
<li>Copy the scope file to the second DHCP server. </li>
<li>Log on locally to the second DHCP server, open the command prompts and run the following command to import the scopes</li>
</ol>
<blockquote><p>Netsh DHCP server 198.168.0.10 import c:\scope 198.168.1.0 198.168.2.0 198.168.3.0</p></blockquote>
<p>Step 3</p>
<ol>
<li>Confirm that the scopes are now on the second server.</li>
<li>Modify the Exclusions if you have any. If this is a split scope then the exclusions should be opposite of each other on the two servers.</li>
</ol>
<p> </p>
<p>Good luck.<br />
<!-smartads-><br />
 </p>
<p> The following is from Technet <a href="http://technet2.microsoft.com/windowsserver/en/library/61427fbd-de1f-4c8a-b613-321f7a3cca6a1033.mspx?mfr=true">http://technet2.microsoft.com/windowsserver/en/library/61427fbd-de1f-4c8a-b613-321f7a3cca6a1033.mspx?mfr=true</a></p>
<blockquote>
<h4>import</h4>
<div class="intro">
<p>Imports a DHCP service configuration from a file to the local service.</p></div>
<h5>Syntax</h5>
<div class="intro">
<p><strong>import</strong> [<em>Path</em>]<em>FileName</em> {<strong>all</strong> | <em>ScopeList</em>]</div>
<h5>Parameters</h5>
<div class="intro">
<div class="definitionList">
<div class="definitionListItem">
<div class="term">[<em>Path</em>] <em>FileName</em></div>
<div class="definition">Required. Specifies, by name, the file from which the DHCP configuration will be imported. If the path, the file name, or both contain spaces, quotation marks must be used.</div>
</div>
<div class="definitionListItem">
<div class="term">{<strong>all </strong>| <em>ScopeList</em>}</div>
<div class="definition">Required. Specifies which scopes you want to import. The parameter <strong>all</strong> imports all scopes represented in the file you specify. The parameter <em>ScopeList</em> imports the scopes that correspond to the IP addresses you list. Each IP address in the list must be separated by spaces.</div>
</div>
</div>
</div>
<h5>Remarks</h5>
<div class="intro">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">This command works only on the local server.</td>
</tr>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">While the <strong>import</strong> command runs, the DHCP service is stopped and does not respond to DHCP clients seeking new leases or lease renewals.</td>
</tr>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">If the DHCP service has a large number of scopes or a large number of client address leases, this command can take a long time to run.</td>
</tr>
</tbody>
</table>
</div>
<h5>Examples</h5>
<div class="intro">
<p>In the first example, this command imports the complete DHCP service configuration from the file c:\Temp\Dhcpdb.</p>
<p>In the second example, this command imports the DHCP configuration for scopes 10.0.0.0 and 192.168.0.0 from the file c:\Temp\Dhcpdb</p>
<p>In the third example, this command imports the complete DHCP service configuration from the file c:\My Folder\Dhcp Configuration. Note that both the path and file name contain spaces, so quotation marks are used.</p>
<p><strong>import c:\Temp\Dhcpdb all</strong></p>
<p><strong>import c:\Temp\Dhcpdb 10.0.0.0 192.168.0.0</strong></div>
<p><strong>import &#8220;c:\My Folder\Dhcp Configuration&#8221; all</strong></p></blockquote>
<p><!--martad--></p>
<p><a href="http://bradstechblog.com"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://bradstechblog.com/netsh/export-and-inport-dhcp-scopes/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
