<?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; Netsh</title>
	<atom:link href="http://tehtech.com/tag/netsh/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.1</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><script type="text/javascript"><!--
google_ad_client = "pub-2740910196434334";
google_ad_slot = "5492961778";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</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>
		<item>
		<title>Change Windows Firewall From Command Line or Batch File</title>
		<link>http://tehtech.com/change-windows-firewall-from-command-line-or-batch-file/</link>
		<comments>http://tehtech.com/change-windows-firewall-from-command-line-or-batch-file/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 00:01:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kaseya]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Netsh]]></category>
		<category><![CDATA[Windows Firewall]]></category>

		<guid isPermaLink="false">http://tehtech.com/?p=212</guid>
		<description><![CDATA[I have a set of scripts I run when I prep a computer for deployment. Â At specific points applications require that the windows firewall be turned off in order to install correctly. Â This is namely ACT! and imagine time. Â They use a bunch of odd ports during install, so their documentation tells you to just [...]]]></description>
			<content:encoded><![CDATA[<p>I have a set of scripts I run when I prep a computer for deployment. Â At specific points applications require that the windows firewall be turned off in order to install correctly. Â This is namely ACT! and imagine time. Â They use a bunch of odd ports during install, so their documentation tells you to just turn off the firewall. Well here is what I found with a little research. Â From run or in a batch file there is a simple netsh command to disable the firewall and one to again enable it.<br />
<span id="more-212"></span><br />
For imagine time my install script looks like this</p>
<div class="box">netsh firewall set opmode disable<br />
g:\Imagine_time\IT_SETUP.exe /q /p<br />
netsh firewall set opmode enable</div>
<p>Â <br />
EffectivelyÂ this will turn off the firewall, install the software silently from a share, and then enable the firewall again after install. I foundÂ somethingÂ interesting with this in regards to kaseya too. Â Sometimes VNC can&#8217;t get through the firewall because it hasÂ defaultedÂ or something went wrong. Â It turns out that if you run this as &#8220;system&#8221; you can actually disable the firewall remotely in many cases. Â This has been a veryÂ helpfulÂ script for when a computer shows &#8216;connectable&#8217; but it just times out when attempting connection.</p>
<div class="box">Script Name: Win Firewall Off</div>
<p>Script Description: Turns off windows firewall</p>
<p>IF TrueÂ </p>
<p>THEN</p>
<p>Â Â  Execute Shell Command</p>
<p>Â Â  Â  Parameter 1 : netsh firewall set opmode <span style="color: #ff0000;">disable</span></p>
<p>Â Â  Â  Parameter 2 : 1</p>
<p>Â Â  Â  Â  Â  OS Type : 0</p>
<p>ELSE</p>
<p>Additionally, Â if you change enable to disable in the above script, you can enable the firewall remotely through kaseya as well.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2740910196434334";
google_ad_slot = "5492961778";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://tehtech.com/change-windows-firewall-from-command-line-or-batch-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

