<?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>Teh Tech &#187; DHCP</title>
	<atom:link href="http://tehtech.com/tag/dhcp/feed/" rel="self" type="application/rss+xml" />
	<link>http://tehtech.com</link>
	<description>Being an Admin is Hard Enough</description>
	<lastBuildDate>Wed, 14 Jul 2010 16:14:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Static and DHCP IP Address Changes Through Scripts</title>
		<link>http://tehtech.com/static-and-dhcp-ip-address-changes-through-scripts/</link>
		<comments>http://tehtech.com/static-and-dhcp-ip-address-changes-through-scripts/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 02:54:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kaseya]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[DHCP]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Netsh]]></category>
		<category><![CDATA[Static IP address]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=251</guid>
		<description><![CDATA[I have a office that uses static IP addresses at the location. The manager just got a laptop that he wants to use at the office and at his house the same static address does not work. So I made him two batch files so he can easily switch between a static IP address in [...]]]></description>
			<content:encoded><![CDATA[<p>I have a office that uses static IP addresses at the location.  The manager just got a laptop that he wants to use at the office and at his house the same static address does not work.  So I made him two batch files so he can easily switch between a static IP address in the office and a dynamic IP address at home.  I was thinking that this could be helpful for making sure everyone in a office is using DHCP and no one is statically assigned.  It could also be really useful for changing say the DNS server address on a set of computers automatically through a login script or kaseya.</p>
<p>It is a super simple script.  The name of the network adaptor must be changed to match the name of the network adaptor you wish to modify settings for.<br />
<span id="more-251"></span><br />
DHCP Through a batch/login script:</p>
<div class="box">netsh int ip set address name = &#8220;<span style="color: #ff0000;">Local Area Connection</span>&#8221; source = dhcp<br />
netsh int ip set dns name = &#8220;<span style="color: #ff0000;">Local Area Connection</span>&#8221; source = dhcp<br />
netsh int ip set wins name = &#8220;<span style="color: #ff0000;">Local Area Connection</span>&#8221; source = dhcp</div>
<p>Static IP address through a batch/login script (change the red to match the addresses you need to set.  IP is the IP address, SM is the subnet mask, gw is the default gateway, dns1 is the primary dns address, dns2 is the secondary dns address):</p>
<div class="box">@ECHO OFF   </p>
<p>set ip=<span style="color: #ff0000;">192.168.1.203</span><br />
set sm=<span style="color: #ff0000;">255.255.255.0</span><br />
set gw=<span style="color: #ff0000;">192.168.1.1</span><br />
set dns1=<span style="color: #ff0000;">4.2.2.2</span><br />
set dns2=<span style="color: #ff0000;">4.2.2.1</span></p>
<p>netsh int ip set address name = &#8220;<span style="color: #ff0000;">Local Area Connection</span>&#8221; source = static addr = %ip% mask = %sm%<br />
netsh int ip set address name = &#8220;<span style="color: #ff0000;">Local Area Connection</span>&#8221; gateway = %gw% gwmetric = 1<br />
netsh int ip set dns name = &#8220;<span style="color: #ff0000;">Local Area Connection</span>&#8221; source = static addr = %dns1%<br />
netsh int ip add dns name = &#8220;<span style="color: #ff0000;">Local Area Connection</span>&#8221; addr = %dns2%<br />
END</div>
<p>DHCP Set through Kaseya</p>
<div class="box">Script Name: Enable DHCP<br />
Script Description: Enables DHCP on the local area conection   </p>
<p>IF True<br />
THEN<br />
Execute Shell Command<br />
Parameter 1 : netsh int ip set dns name = &#8220;Local Area Connection&#8221; source = dhcp<br />
Parameter 2 : 1<br />
OS Type : 0<br />
Execute Shell Command<br />
Parameter 1 : netsh int ip set address name = &#8220;Local Area Connection&#8221; source = dhcp<br />
Parameter 2 : 1<br />
OS Type : 0<br />
Execute Shell Command<br />
Parameter 1 : netsh int ip set wins name = &#8220;Local Area Connection&#8221; source = dhcp<br />
Parameter 2 : 1<br />
OS Type : 0<br />
ELSE</p></div>
<p>You can also use this same pattern to set just one line.  For example to use kaseya to quickly change the DNS server address on several computers you can use this. (note 4.2.2.2 is a open DNS server but change it to match what you need):</p>
<div class="box">Script Name: Change DNS to Open DNS<br />
Script Description: Sets DNS on Local Area connection to 4.2.2.2 </p>
<p>IF True<br />
THEN<br />
Execute Shell Command<br />
Parameter 1 : netsh int ip set dns name = &#8220;Local Area Connection&#8221; source = static addr = <span style="color: #ff0000;">4.2.2.2</span><br />
Parameter 2 : 1<br />
OS Type : 0<br />
ELSE</div>
<p>[ad]</p>
]]></content:encoded>
			<wfw:commentRss>http://tehtech.com/static-and-dhcp-ip-address-changes-through-scripts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
