<?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>Makl Ndrix &#187; batch file</title>
	<atom:link href="http://michaelhendrickx.com/tag/batch-file/feed" rel="self" type="application/rss+xml" />
	<link>http://michaelhendrickx.com</link>
	<description>may contain traces of nuts</description>
	<lastBuildDate>Thu, 17 May 2012 21:03:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Changing NSClient++ configurations in bulk</title>
		<link>http://michaelhendrickx.com/201005_changing-nsclient-configurations-in-bulk.html</link>
		<comments>http://michaelhendrickx.com/201005_changing-nsclient-configurations-in-bulk.html#comments</comments>
		<pubDate>Tue, 11 May 2010 10:20:55 +0000</pubDate>
		<dc:creator>Michael Hendrickx</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[batch file]]></category>
		<category><![CDATA[ghetto]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[nsclient]]></category>

		<guid isPermaLink="false">http://michaelhendrickx.com/?p=277</guid>
		<description><![CDATA[At work, we started using Nagios to monitor the hosts and their services for any issues, so we can, proactively, take actions when we see trouble coming (hard disk that fills up rapidly, restarting services, etc). Recently we change the Nagios host to another IP address and found ourselves having to change a few dozen [...]<div class="addthis_toolbox addthis_default_style " addthis:url='http://michaelhendrickx.com/201005_changing-nsclient-configurations-in-bulk.html' addthis:title='Changing NSClient++ configurations in bulk'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></description>
			<content:encoded><![CDATA[<p><img src="http://michaelhendrickx.com/wp-content/uploads/2010/05/nagios.jpg" alt="" title="nagios" width="255" height="172" align="right" />At <a href="http://www.nakheel.com">work</a>, we started using Nagios to monitor the hosts and their services for any issues, so we can, proactively, take actions when we see trouble coming (hard disk that fills up rapidly, restarting services, etc).</p>
<p>Recently we change the Nagios host to another IP address and found ourselves having to change a few dozen NSClient.ini files on the server.  Even though we use DNS names as monitoring host (only nsclient access on port 12489/tcp is allowed from a certain host), NSClient by default caches the IP address (Using <strong>cache_allowed_hosts</strong>, which is set to &#8220;1&#8243; by default) so we were bound to change quite some files.</p>
<p>To do this, we have to do the following:<span id="more-277"></span></p>
<ul>
<li>stop the nsclient service</li>
<li>overwrite the nsclient.ini file</li>
<li>start the nsclient service</li>
</ul>
<p>For reasons i cannot disclose, this could not be done using any group policies.  So we went the ghetto batch way:</p>
<p><code><br />
@psexec \\%1 "C:\Program Files\NSClient++\NSclient++.exe" -uninstall<br />
@xcopy /Y C:\tool\nagios\nsclient\* "\\%1\c$\program files\nsclient++\"<br />
@psexec \\%1 "C:\Program Files\NSClient++\NSclient++.exe" -install<br />
@psexec \\%1 "C:\Program Files\NSClient++\NSclient++.exe" -start<br />
@echo Finished %1<br />
</code></p>
<p>This assumes you have nsclient++ already, which is an awesome piece of software that you can grab from <a href="http://nsclient.org/">nsclient.org</a>, and that you have <a href="http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx">psexec</a> installed to execute commands.</p>
<p>Using this script, you can just run <strong>C:\tool\nagios\update_nsc.bat server_name</strong> to have the server monitored again.</p>
<p>Thank you,<br />
Michael</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelhendrickx.com/201005_changing-nsclient-configurations-in-bulk.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Keeping windows services&#8217; running, ghetto style</title>
		<link>http://michaelhendrickx.com/200902_keeping-windows-services-running-ghetto-style.html</link>
		<comments>http://michaelhendrickx.com/200902_keeping-windows-services-running-ghetto-style.html#comments</comments>
		<pubDate>Tue, 24 Feb 2009 14:05:06 +0000</pubDate>
		<dc:creator>Michael Hendrickx</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[batch file]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[dns service]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[win2003]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://michaelhendrickx.com/?p=132</guid>
		<description><![CDATA[A small post, but so I can have it as a reference if I ever encouter it again. We&#8217;ve setup a Windows 2003 Domain, and run DNS on both the Domain Controllers. We have terrible issues with DNS always shutting down, and disabling itself, so it won&#8217;t boot up again. While we are breaking our [...]<div class="addthis_toolbox addthis_default_style " addthis:url='http://michaelhendrickx.com/200902_keeping-windows-services-running-ghetto-style.html' addthis:title='Keeping windows services&#8217; running, ghetto style'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></description>
			<content:encoded><![CDATA[<p><a href="http://michaelhendrickx.com/wp-content/uploads/2009/02/restart.jpg"><img src="http://michaelhendrickx.com/wp-content/uploads/2009/02/restart.jpg" alt="" title="restart" width="268" height="300" class="alignright size-medium wp-image-133" /></a>A small post, but so I can have it as a reference if I ever encouter it again.  We&#8217;ve setup a Windows 2003 Domain, and run DNS on both the Domain Controllers.  We have terrible issues with DNS always shutting down, and disabling itself, so it won&#8217;t boot up again.</p>
<p>While we are breaking our heads on how this happens, we made a small two-liner script to enable a Windows service over the command line.  We&#8217;ve put this in the recovery tab, and scheduled it as a task to run every hour.</p>
<p>The code to enable the DNS service, and to restart the service is below:</p>
<p><code><br />
sc config DNS start= auto<br />
net start dns<br />
</code></p>
<p>I know it&#8217;s very ghetto way of keeping DNS running, but we&#8217;re figuring out why DNS always shuts down.  Until then, this provides us necesarry DNS uptime <img src='http://michaelhendrickx.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Thanks,<br />
Michael</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelhendrickx.com/200902_keeping-windows-services-running-ghetto-style.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

