<?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>The Geekery</title>
	<atom:link href="http://jon.netdork.net/feed" rel="self" type="application/rss+xml" />
	<link>http://jon.netdork.net</link>
	<description>The Usual Stuff...</description>
	<lastBuildDate>Wed, 11 Aug 2010 02:37:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PowerShell: Active Directory, and User Groups</title>
		<link>http://jon.netdork.net/2010/08/10/powershell-active-directory-and-user-groups?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=powershell-active-directory-and-user-groups</link>
		<comments>http://jon.netdork.net/2010/08/10/powershell-active-directory-and-user-groups#comments</comments>
		<pubDate>Wed, 11 Aug 2010 01:02:06 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=924</guid>
		<description><![CDATA[Matt Simmons posted a question today on Twitter&#8230; The cool thing about PowerShell, like Perl, if it can be done one way, there are probably 10 other ways to achieve the same thing. Here are a couple&#8230; Method 1 &#8211; ADSI $user = &#91;ADSI&#93;&#40;&#34;CN=Jonathan Angliss,CN=User,DC=local,DC=mydomain,DC=com&#34;&#41; foreach&#40;$group in $user.MemberOf&#41; &#123; &#160; $group &#125; This method will [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F08%2F10%2Fpowershell-active-directory-and-user-groups">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F08%2F10%2Fpowershell-active-directory-and-user-groups&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p><a href="http://www.standalone-sysadmin.com/blog/" title="Standalone Sysadmin">Matt Simmons</a> posted a question today on <a href="http://twitter.com/standaloneSA/status/20805228097" title="Twitter; Standalone SA">Twitter</a>&#8230; </p>

<!-- tweet id : 20805228097 -->
			<style type='text/css'>#bbpBox_20805228097{background:#1A1B1F url(http://a3.twimg.com/profile_background_images/106552711/twitter-backgrounda.jpg) no-repeat !important;padding:20px;}#bbpBox_20805228097 p.bbpTweet{background:#fff;padding:10px 12px 10px 12px !important;margin:0 !important;min-height:48px;color:#666666 !important;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px}#bbpBox_20805228097 p.bbpTweet a {color:#2FC2EF !important}#bbpBox_20805228097 p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px  !important;padding-top:12px !important;height:40px;border-top:1px solid #e6e6e6}#bbpBox_20805228097 p.bbpTweet span.metadata span.author{line-height:19px}#bbpBox_20805228097 p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0px 0px !important;width:38px;height:38px;padding:0 !important;border:none !important;}#bbpBox_20805228097 p.bbpTweet a:hover{text-decoration:underline}#bbpBox_20805228097 p.bbpTweet span.timestamp{font-size:12px;display:block}</style>
			 
			<div id='bbpBox_20805228097'><p class='bbpTweet'>Anyone know how to show a user's group membership in powershell?<span class='timestamp'><a title='tweeted on August 10, 2010 15:55' href='http://twitter.com/standaloneSA/status/20805228097'>August 10, 2010 15:55</a> via <a href="http://www.hootsuite.com" rel="nofollow">HootSuite</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/standaloneSA'><img src='http://a3.twimg.com/profile_images/277743807/me-hoodie_normal.jpg' /></a><strong><a href='http://twitter.com/standaloneSA'>standaloneSA</a></strong><br />Matt Simmons</span></span></p></div>
			<!-- end of tweet -->

<p>The cool thing about PowerShell, like <acronym title="Practical Extraction and Report Language">Perl</acronym>, if it can be done one way, there are probably 10 other ways to achieve the same thing.  Here are a couple&#8230;
<span id="more-924"></span></p>

<h2>Method 1 &#8211; ADSI</h2>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #800080;">$user</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;CN=Jonathan Angliss,CN=User,DC=local,DC=mydomain,DC=com&quot;</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$user</span>.MemberOf<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #800080;">$group</span><br />
<span style="color: #000000;">&#125;</span></div></div>

<p>This method will show the full DN of each group the user is a member of.</p>

<h2>Method 2 &#8211; Quest&#8217;s Active Directory PowerPack</h2>

<p>I&#8217;ve been a PowerGUI user for a bit, and the Quest AD PowerPack is pretty damn cool.  You don&#8217;t have to buy the full product, there is an open source version of <a href="http://powergui.org/index.jspa" title="PowerGui">PowerGui</a>, but the AD tools are at Quest&#8217;s site <a href="http://www.quest.com/powershell/activeroles-server.aspx" title="Quest; PowerShell for Active Directory">here</a>.  This one is a little easier, as you don&#8217;t have to know the full DN for the user, you can search by name, phone, all kinds.  Here is a simple example:</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #800080;">$user</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>QADUser <span style="color: pink;">-</span>FirstName <span style="color: #800000;">&quot;Jonathan&quot;</span> <span style="color: pink;">-</span>LastName <span style="color: #800000;">&quot;Angliss&quot;</span><br />
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$user</span>.MemberOf<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #800080;">$group</span><br />
<span style="color: #000000;">&#125;</span></div></div>

<p>This too returns the full DN for the groups.</p>

<h2>Method 3 &#8211; Windows 2008 R2 AD Modules</h2>

<p>Now there are some requirements behind this one, so go check them <a href="http://technet.microsoft.com/en-us/library/dd378937%28WS.10%29.aspx" title="Microsoft TechNet; AD Administration with Windows PowerShell">out</a>, the least of which is a Windows 2008 R2 server.  It&#8217;s a little unclear if the R2 box has to be a domain controller or not, but the 2008R2 Active Directory Web Services (ADWS) must be installed on at least one DC.</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Get<span style="color: pink;">-</span>ADPrincipalGroupMembership <span style="color: pink;">-</span>Identity <span style="color: #800000;">&quot;CN=Jonathan Angliss,CN=User,DC=local,DC=mydomain,DC=com&quot;</span></div></div>

<p>I cannot validate the syntax exactly on this one, as I don&#8217;t have the facilities available to do so.</p>

<p>But there you have it, 3 quick commands to get you access to the user&#8217;s groups.</p>

<p><strong>EDIT:</strong> I found another one, which uses the ADSI method, but calls up the Directory Services modules&#8230;</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #800080;">$searchHandler</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> DirectoryServices.DirectorySearcher<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><br />
<br />
<span style="color: #800080;">$searchHandler</span>.<span style="color: #0000FF;">filter</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;(&amp;(objectClass=user)(sAMAccountName=jonathan.angliss))&quot;</span><br />
<br />
<span style="color: #800080;">$foundUser</span> <span style="color: pink;">=</span> <span style="color: #800080;">$searchHandler</span>.findOne<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
<br />
<span style="color: #800080;">$properties</span> <span style="color: pink;">=</span> <span style="color: #800080;">$foundUser</span>.Properties<br />
<br />
<span style="color: #800080;">$properties</span>.get_Item<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;memberof&quot;</span><span style="color: #000000;">&#41;</span></div></div>

<p>This one requires a little understanding of LDAP searches, but not too bad otherwise.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/08/10/powershell-active-directory-and-user-groups/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	
	
	<!-- google ad injected by adsense-optimizer http://www.adsenseoptimizer.de -->
	<div  style="padding:7px; display: block; margin-left: auto; margin-right: auto; text-align: center;"><!-- Linkblock number: 1 --><script type="text/javascript"><!--
	 
google_ad_client = "pub-5380792458095798";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al"; google_ad_channel ="";
google_color_border = "CCCCCC";
google_color_bg = "F7F7F7";
google_color_link = "2970A6";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>	<item>
		<title>Configuration Management (Part III): Managing your configuration</title>
		<link>http://jon.netdork.net/2010/08/09/configuration-management-part-iii-managing-your-configuration?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=configuration-management-part-iii-managing-your-configuration</link>
		<comments>http://jon.netdork.net/2010/08/09/configuration-management-part-iii-managing-your-configuration#comments</comments>
		<pubDate>Tue, 10 Aug 2010 05:18:17 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=922</guid>
		<description><![CDATA[This one has been sitting idle for a couple of weeks.&#160; Lethargy kicked in, and work was consuming too much of my brain power, but here it is, I’m working on getting it out the door.&#160; In this episode, we’ll be running through the basics of svn, and getting it working with the files we [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F08%2F09%2Fconfiguration-management-part-iii-managing-your-configuration">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F08%2F09%2Fconfiguration-management-part-iii-managing-your-configuration&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p></p><p>This one has been sitting idle for a couple of weeks.&#160; Lethargy kicked in, and work was consuming too much of my brain power, but here it is, I’m working on getting it out the door.&#160; In this episode, we’ll be running through the basics of svn, and getting it working with the files we have in place, adding new files, reverting, and planning for big upgrades… Note, this is more of an <acronym title="Subversion">SVN</acronym> primer than anything.&#160; If you know how to tag, branch, revert, have a good general knowledge of <acronym title="Subversion">SVN</acronym>, this one can be skipped.</p>  <span id="more-922"></span>  <h2>Modifying a File</h2>  <p>The machine I’m working on has Bind installed.&#160; First lets edit the <em>named.conf.local</em> file, and add reference to a new zone file. </p>  <p><span style="color: #c20cb9; font-weight: bold">cat</span> <span style="color: #000000; font-weight: bold">&gt;&gt;</span> <span style="color: #000000; font-weight: bold">/</span>etc<span style="color: #000000; font-weight: bold">/</span>bind<span style="color: #000000; font-weight: bold">/</span>named.conf.local     <br />    <br />zone <span style="color: #ff0000">&quot;local.netdork.net&quot;</span> <span style="color: #7a0874; font-weight: bold">{</span>     <br />&#160;&#160;&#160; <span style="color: #7a0874; font-weight: bold">type</span> master;     <br />&#160;&#160;&#160; <span style="color: #c20cb9; font-weight: bold">file</span> <span style="color: #ff0000">&quot;/etc/bind/db.local.netdork.net&quot;</span>;     <br /><span style="color: #7a0874; font-weight: bold">}</span>;</p>  <br />  <p>Hit <em>CTRL-D</em> and it’ll quit the <em>cat</em> command, and append the data to the file (note I used &gt;&gt;).&#160; We can verify this by simply doing a quick cat again:</p>  <p>&#160;</p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #c20cb9; font-weight: bold">cat</span> <span style="color: #000000; font-weight: bold">/</span>etc<span style="color: #000000; font-weight: bold">/</span>bind<span style="color: #000000; font-weight: bold">/</span>named.conf.local</div>  <br />Now we’ve verified we have content added to the file, lets see what <acronym title="Subversion">SVN</acronym> thinks about our new directory changes.   <p>&#160;</p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #7a0874; font-weight: bold">cd</span> <span style="color: #000000; font-weight: bold">/</span>etc     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> <span style="color: #c20cb9; font-weight: bold">diff</span></div>  <br />  <p>Now we see a handful of lines that look like this:</p>  <p>&#160;</p>  <div style="font-family: consolas,; font-size: small" class="diff" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?">Index: bind/named.conf.local    <br />===================================================================     <br /><span style="color: #888822">&#8212; bind/named.conf.local&#160;&#160;&#160;&#160;&#160;&#160; <span>(</span>revision 5<span>)</span></span>     <br /><span style="color: #888822">+++ bind/named.conf.local&#160;&#160;&#160;&#160;&#160;&#160; <span>(</span>working copy<span>)</span></span>     <br /><span style="color: #440088">@@ -6,3 +6,9 @@</span>     <br />// organization     <br />//include &quot;/etc/bind/zones.rfc1918&quot;;     <br />&#160; <br /><span style="color: #00b000">+</span>     <br /><span style="color: #00b000">+zone &quot;local.netdork.net&quot; <span>{</span></span>     <br /><span style="color: #00b000">+&#160;&#160;&#160; type master;</span>     <br /><span style="color: #00b000">+&#160;&#160;&#160; file &quot;/etc/bind/db.local.netdork.net&quot;;</span>     <br /><span style="color: #00b000">+<span>}</span>;</span>     <br /><span style="color: #00b000">+</span></div>  <br />This can be sent to a file, and used as a patch on another system.&#160; The format is a predefined layout that tells another system all the information it needs to update another file.&#160; For example, lines starting with a – are removed from a file, those with a + are added to the file.&#160; This shows that the difference between my <acronym title="Subversion">SVN</acronym> backup, and my live copy is the changes I’d just made.&#160; Now as I want to keep those, I’m going to check them in.   <p>&#160;</p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #c20cb9; font-weight: bold">svn</span> commit <span style="color: #660033">-m</span> <span style="color: #ff0000">&quot;Adding local.netdork.net zone reference&quot;</span> named.conf.local</div>  <br />  <p>The –m argument allows you to add a message.&#160; If you need to add a longer message, such as a multi-line entry, omit that argument, and the text, and <acronym title="Subversion">SVN</acronym> should prompt in your default editor.</p>  <h2>Adding a New File</h2>  <p>Now we’ve added our reference, lets create the zone file quickly. I’m going to cheat in this case for speed, and copy Debian’s <em>db.local</em> file to the new name.</p>  <p>&#160;</p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #c20cb9; font-weight: bold">cp</span> <span style="color: #000000; font-weight: bold">/</span>etc<span style="color: #000000; font-weight: bold">/</span>bind<span style="color: #000000; font-weight: bold">/</span>db.local <span style="color: #000000; font-weight: bold">/</span>etc<span style="color: #000000; font-weight: bold">/</span>bind<span style="color: #000000; font-weight: bold">/</span>db.local.netdork.net</div>  <br />Now bind is going to be happy, however, we now have a new file to add to svn.&#160; We can see this by using the status command.   <p>&#160;</p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #c20cb9; font-weight: bold">svn</span> status     <br />? bind<span style="color: #000000; font-weight: bold">/</span>db.local.netdork.net     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> add bind<span style="color: #000000; font-weight: bold">/</span>db.local.netdork.net     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> commit <span style="color: #660033">-m</span> <span style="color: #ff0000">&quot;Adding zone file for local.netdork.net for Bind&quot;</span> bind<span style="color: #000000; font-weight: bold">/</span>db.local.netdork.net</div>  <br />The <em>?</em> shows the new file, modified files will show M, deleted D, and A will show added files with no commits.   <br />  <p>&#160;</p>  <h2>Reverting a change</h2>  <p>You know we’ve all done it.&#160; Edited a file, it didn’t work out, but you forgot what you changed. That’s what version control does, keeps previous versions, saves our bacon when we need it. We’re going to go extreme here, we’re going to trash the main Bind configuration with some random data. Ignoring the syntax if you don’t know what it does, I’m basically taking the random entropy source, and dumping it into the <em>named.conf</em> file, not a good thing, that’s for sure.</p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?">&#160;<span style="color: #c20cb9; font-weight: bold">dd</span> <span style="color: #007800">bs</span>=<span style="color: #000000">1024</span> <span style="color: #007800">count</span>=<span style="color: #000000">1</span> <span style="color: #007800">if</span>=<span style="color: #000000; font-weight: bold">/</span>dev<span style="color: #000000; font-weight: bold">/</span>urandom <span style="color: #007800">of</span>=<span style="color: #000000; font-weight: bold">/</span>etc<span style="color: #000000; font-weight: bold">/</span>bind<span style="color: #000000; font-weight: bold">/</span>named.conf     <br />&#160; <span style="color: #000000">1</span>+<span style="color: #000000">0</span> records <span style="color: #000000; font-weight: bold">in</span>     <br />&#160; <span style="color: #000000">1</span>+<span style="color: #000000">0</span> records out     <br />&#160; <span style="color: #000000">1024</span> bytes <span style="color: #7a0874; font-weight: bold">(</span><span style="color: #000000">1.0</span> kB<span style="color: #7a0874; font-weight: bold">)</span> copied, <span style="color: #000000">0.000929448</span> s, <span style="color: #000000">1.1</span> <acronym title="Megabyte">MB</acronym><span style="color: #000000; font-weight: bold">/</span>s     <br /><span style="color: #c20cb9; font-weight: bold">head</span> <span style="color: #000000; font-weight: bold">/</span>etc<span style="color: #000000; font-weight: bold">/</span>bind<span style="color: #000000; font-weight: bold">/</span>named.conf     <br />&#160; <span style="font-style: italic; color: #666666">#lots of random stuff#</span>     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> status     <br />M&#160;&#160;&#160; bind<span style="color: #000000; font-weight: bold">/</span>named.conf</div>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?">&#160;</div>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?">So using my above, rather destructive code, I’ve overwritten /etc/named.conf with 1MB of random data. That’s okay, we’re going to call on the revert command.</div>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?">&#160;</div>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #c20cb9; font-weight: bold">svn</span> revert bind<span style="color: #000000; font-weight: bold">/</span>named.conf     <br />Reverted <span style="color: #ff0000">&#8216;bind/named.conf&#8217;</span>     <br /><span style="color: #c20cb9; font-weight: bold">head</span> bind<span style="color: #000000; font-weight: bold">/</span>named.conf</div>  <br />  <p><font size="2" face="Consolas">And we’re back to how we were.&#160; That’s great, it means Bind will be happy again.</font></p>  <p><font size="2" face="Consolas">What happens if it’s a change we committed? What if we made a change, committed it, and discovered it was an issue a week later, but we don’t remember exactly what it was?&#160; First, lets look at the log, and see when the file was changed, revision, and the (hopefully) useful log entry we added…</font></p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #c20cb9; font-weight: bold">svn</span> log bind<span style="color: #000000; font-weight: bold">/</span>named.conf.local     <br /><span style="color: #660033">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span>     <br />r7 <span style="color: #000000; font-weight: bold">|</span> root <span style="color: #000000; font-weight: bold">|</span> <span style="color: #000000">2010</span>-08-09 <span style="color: #000000">21</span>:<span style="color: #000000">38</span>:<span style="color: #000000">36</span> <span style="color: #660033">-0500</span> <span style="color: #7a0874; font-weight: bold">(</span>Mon, 09 Aug <span style="color: #000000">2010</span><span style="color: #7a0874; font-weight: bold">)</span> <span style="color: #000000; font-weight: bold">|</span> <span style="color: #000000">1</span> line     <br />    <br />Adding local.netdork.net zone reference     <br /><span style="color: #660033">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span>     <br />r5 <span style="color: #000000; font-weight: bold">|</span> root <span style="color: #000000; font-weight: bold">|</span> <span style="color: #000000">2010</span>-06-<span style="color: #000000">30</span> <span style="color: #000000">20</span>:06:<span style="color: #000000">27</span> <span style="color: #660033">-0500</span> <span style="color: #7a0874; font-weight: bold">(</span>Wed, <span style="color: #000000">30</span> Jun <span style="color: #000000">2010</span><span style="color: #7a0874; font-weight: bold">)</span> <span style="color: #000000; font-weight: bold">|</span> <span style="color: #000000">2</span> lines     <br />    <br />Updates     <br /><span style="color: #660033">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></div>  <br />  <p><font size="2" face="Consolas">There, we see there were 2 changes committed to this file. Part of the initial commit (yes I created a bad log entry there), and r7, which is the one we just made. So lets say we want to get back to r5, unfortunately svn doesn’t have a “rollback” to a specific version, you have to merge backwards the changes.&#160; This isn’t too difficult to do, we’ll use the example from the modifying files at the top to roll back…</font></p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #7a0874; font-weight: bold">cd</span> <span style="color: #000000; font-weight: bold">/</span>etc<span style="color: #000000; font-weight: bold">/</span><span style="color: #7a0874; font-weight: bold">bind</span>     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> log named.conf.local     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> merge <span style="color: #660033">&#8211;revision</span> <span style="color: #000000">7</span>:<span style="color: #000000">5</span> named.conf.local     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> status     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> <span style="color: #c20cb9; font-weight: bold">diff</span> named.conf.local     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> commit <span style="color: #660033">-m</span> <span style="color: #ff0000">&quot;Removing local.netdork.net from Bind&quot;</span> named.conf.local</div>  <p><font size="2" face="Consolas"></font></p>  <p>In this example, we looked at the log, and see the entry was r7 for when we committed the entry for the <em>local.netdork.net</em> zone entry, and r5 was the last change before that.&#160; So the command merges from 7 down to 5. svn status will now show that the file has changed, and diff will show the inverse of the top second.&#160; Commit just solidifies the work.</p>  <p>&#160;</p>  <h2>Handling Major Upgrades</h2>  <p>Major upgrades are difficult, we want a point in time restore.&#160; What happens if the upgrade goes badly, and we need to roll back a couple of packages, but the config files don’t get reverted? Whilst <acronym title="Subversion">SVN</acronym> will handle that using the above methods, we’re going to want to keep a way of finding those changes easily.&#160; This is where tags come in handy.&#160; They’re a complete copy of an existing branch. We’re going to make a folder for tags, and make a full copy of the current config.</p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #c20cb9; font-weight: bold">svn</span> <span style="color: #c20cb9; font-weight: bold">mkdir</span> <span style="color: #660033">&#8211;parents</span> <span style="color: #660033">-m</span> <span style="color: #ff0000">&quot;Creating tags folder&quot;</span> <span style="color: #c20cb9; font-weight: bold">file</span>:<span style="color: #000000; font-weight: bold">///</span>srv<span style="color: #000000; font-weight: bold">/</span>svn<span style="color: #000000; font-weight: bold">/</span>thebe<em>config<span style="color: #000000; font-weight: bold">/</span>tags     <br /><span style="color: #c20cb9; font-weight: bold">svn</span> copy <span style="color: #660033">-m</span> <span style="color: #ff0000">&quot;Backup for Thebe Debian 5.0.5 on 08/09/2010&quot;</span> \     <br />&#160; <span style="color: #c20cb9; font-weight: bold">file</span>:<span style="color: #000000; font-weight: bold">///</span>srv<span style="color: #000000; font-weight: bold">/</span>svn<span style="color: #000000; font-weight: bold">/</span>thebe</em>config<span style="color: #000000; font-weight: bold">/</span>trunk \     <br />&#160; <span style="color: #c20cb9; font-weight: bold">file</span>:<span style="color: #000000; font-weight: bold">///</span>srv<span style="color: #000000; font-weight: bold">/</span>svn<span style="color: #000000; font-weight: bold">/</span>thebe<em>config<span style="color: #000000; font-weight: bold">/</span>tags<span style="color: #000000; font-weight: bold">/</span><span style="color: #000000">20100809</span></em>deb505</div>  <p style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?">&#160;</p>  <p>You’ll see the standard <acronym title="Subversion">SVN</acronym> commit confirmation, now we can checkout the results using a command we used in part II.</p>  <p>&#160;</p>  <div style="font-family: consolas,; font-size: small" class="bash" courier="courier" new?,="New?," courier,="courier," monospace;="monospace;" background-color:="background-color:" #ffffff;?="#ffffff;?"><span style="color: #c20cb9; font-weight: bold">svnlook</span> <span style="color: #c20cb9; font-weight: bold">tree</span> <span style="color: #000000; font-weight: bold">/</span>srv<span style="color: #000000; font-weight: bold">/</span>svn<span style="color: #000000; font-weight: bold">/</span>thebe<em>config <span style="color: #000000; font-weight: bold">|</span> <span style="color: #c20cb9; font-weight: bold">more</span></em></div>  <p>   <br />If you skim through the results, you’ll now see a tags folder, with a subfolder 20100809deb505, and a complete copy of Trunk.</p>  <p>Now we’ve done that, and we do the upgrade, we can go back at any point, and see what was changed… </p>  <div style="background-color: #ffffff; font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: small" class="bash"><span style="color: #c20cb9; font-weight: bold">svn</span> <span style="color: #c20cb9; font-weight: bold">diff</span> <span style="color: #660033">&#8211;old</span>=<span style="color: #c20cb9; font-weight: bold">file</span>:<span style="color: #000000; font-weight: bold">///</span>srv<span style="color: #000000; font-weight: bold">/</span>svn<span style="color: #000000; font-weight: bold">/</span>thebe<em>config<span style="color: #000000; font-weight: bold">/</span>tags<span style="color: #000000; font-weight: bold">/</span><span style="color: #000000">20100809</span></em>deb505 \     <br />&#160; <span style="color: #660033">&#8211;new</span>=<span style="color: #c20cb9; font-weight: bold">file</span>:<span style="color: #000000; font-weight: bold">///</span>srv<span style="color: #000000; font-weight: bold">/</span>svn<span style="color: #000000; font-weight: bold">/</span>thebe_config<span style="color: #000000; font-weight: bold">/</span>trunk<span style="color: #000000; font-weight: bold">/</span></div>  <p>&#160;</p>  <h2>Finishing up</h2>  <p>There is one thing I didn’t do above, but thought I’d point it out at the bottom to emphasis it a little bit.&#160; Some files need special permissions, and we want to retain those too.&#160; You might remember in the previous edition, we introduced asvn, which was a wrapper script around the svn command.&#160; Once you’ve added your files to svn, use the asvn script to update svn with the info flags for the file, and check that in too.&#160; You can see how to use the command in <a title="TheGeekery; Configuration Management (Part II): Setting up SVN" href="http://jon.netdork.net/2010/06/28/configuration-management-part-ii-setting-up-svn" target="_blank">part II</a>.</p>  <p>Now we have a good basis for storing and archiving our configurations, next time we’ll look at monitoring them for changes that aren’t checked in.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/08/09/configuration-management-part-iii-managing-your-configuration/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>F5 and Passive host monitoring</title>
		<link>http://jon.netdork.net/2010/07/31/f5-and-passive-host-monitoring?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=f5-and-passive-host-monitoring</link>
		<comments>http://jon.netdork.net/2010/07/31/f5-and-passive-host-monitoring#comments</comments>
		<pubDate>Sat, 31 Jul 2010 06:00:56 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/2010/07/31/f5-and-passive-host-monitoring</guid>
		<description><![CDATA[Lori MacVittie has an excellent article on passive host monitoring in an F5 Big-IP environment.&#160; Introduced in v10, BIG-IP load balancers now support something called Inband Monitoring.&#160; This basically sniffs the traffic, and responds based on the rule you define.&#160; Lori put an example up which looks for the HTTP error codes above 500, and [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F31%2Ff5-and-passive-host-monitoring">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F31%2Ff5-and-passive-host-monitoring&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>Lori MacVittie has an excellent <a title="F5 Friday: Eavesdropping on Availability" href="http://devcentral.f5.com/weblogs/macvittie/archive/2010/07/30/f5-friday-eavesdropping-on-availability.aspx" target="_blank">article</a> on passive host monitoring in an F5 Big-<acronym title="Internet Protocol">IP</acronym> environment.&#160; Introduced in v10, BIG-<acronym title="Internet Protocol">IP</acronym> load balancers now support something called <em>Inband Monitoring</em>.&#160; This basically sniffs the traffic, and responds based on the rule you define.&#160; Lori put an example up which looks for the <acronym title="HyperText Transfer Protocol">HTTP</acronym> error codes above 500, and after 3 errors seen in the responses, it marks that host as unavailable.&#160; This is a great feature as it doesn’t add any load to the web servers with active checks, and if you have ever looked at a host that i s behind a load balancer, log analysis can be a pain.&#160; The cool thing is, after the host has been disabled, the passive check can enable your regular active checks to bring the host back up when the issue is resolved. Some excellent stuff.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/07/31/f5-and-passive-host-monitoring/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to SNMP</title>
		<link>http://jon.netdork.net/2010/07/18/intro-to-snmp?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=intro-to-snmp</link>
		<comments>http://jon.netdork.net/2010/07/18/intro-to-snmp#comments</comments>
		<pubDate>Sun, 18 Jul 2010 16:53:23 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Sys Admin]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/2010/07/18/intro-to-snmp</guid>
		<description><![CDATA[Matt Simmons, of Standalone Sysadmin fame, has a great post up about SNMP, giving a good all around introduction to SNMP.&#160; I highly recommend reading it if you’re getting started in networks, or even if you just want to brush up.]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F18%2Fintro-to-snmp">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F18%2Fintro-to-snmp&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>Matt Simmons, of <a title="Standalone Sysadmin" href="http://www.standalone-sysadmin.com/" target="_blank">Standalone Sysadmin</a> fame, has a great <a title="Standalone SA; Introduction to SNMP" href="http://www.standalone-sysadmin.com/blog/2010/07/introduction-to-snmp/" target="_blank">post</a> up about SNMP, giving a good all around introduction to SNMP.&#160; I highly recommend reading it if you’re getting started in networks, or even if you just want to brush up.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/07/18/intro-to-snmp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: Loops, ForEach, ForEach-Object, and control functions</title>
		<link>http://jon.netdork.net/2010/07/13/powershell-loops-foreach-control-functions?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=powershell-loops-foreach-control-functions</link>
		<comments>http://jon.netdork.net/2010/07/13/powershell-loops-foreach-control-functions#comments</comments>
		<pubDate>Wed, 14 Jul 2010 04:02:14 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=915</guid>
		<description><![CDATA[In my previous post about PowerShell and BITS, I stumbled on a weird quirk in the ForEach-Object function, which had me scratching my head for a bit. In most programming languages, where you have a for, loop, while, foreach, or other such loop, there is often a set of control functions that go with it. [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F13%2Fpowershell-loops-foreach-control-functions">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F13%2Fpowershell-loops-foreach-control-functions&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>In my previous post about <a href="http://jon.netdork.net/2010/07/08/powershell-and-bits" title="The Geekery; PowerShell and BITS">PowerShell and BITS</a>, I stumbled on a weird quirk in the ForEach-Object function, which had me scratching my head for a bit.</p>

<p><span id="more-915"></span></p>

<p>In most programming languages, where you have a for, loop, while, foreach, or other such loop, there is often a set of control functions that go with it.  <em>Continue</em> and <em>Break</em>.  These functions alter the way a loop is behaving at that time.  A call to <em>Continue</em> will stop the current loop iteration at that point in the code, and jump onto the next.  A simple example would look like this:</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000FF;">for</span><span style="color: #000000;">&#40;</span> <span style="color: #800080;">$i</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>; <span style="color: #800080;">$i</span> <span style="color: #FF0000;">-lt</span> <span style="color: #804000;">5</span>; <span style="color: #800080;">$i</span><span style="color: pink;">++</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$i</span> <span style="color: #FF0000;">-eq</span> <span style="color: #804000;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0000FF;">continue</span>;<br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #800080;">$i</span><br />
<span style="color: #000000;">&#125;</span></div></div>

<p>This code simply takes the variable $i, sets it to 0, and whilst $i is less than 5, it loops through the code, each iteration increasing the value of $i by 1.  The if statement executes special code when $i gets to the number 2.  Now if we run this code, we get the following:</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #804000;">0</span><br />
<span style="color: #804000;">1</span><br />
<span style="color: #804000;">3</span><br />
<span style="color: #804000;">4</span></div></div>

<p>What happened was the counter hit 2, and the code said that it was done with this iteration, and continue processing the outer loop.  A <em>Break</em> on the other hand just tells the loop it&#8217;s done processing, and to stop looping, and get out.  Using the same example as above, but changing <em>Continue</em> to <em>Break</em> we get the output that looks like this:</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #804000;">0</span><br />
<span style="color: #804000;">1</span></div></div>

<p>This is because PowerShell has been told to stop processing any further.</p>

<p>Now for the quirk.  I discovered that <em>ForEach-Object</em> isn&#8217;t actually a programmatic keyword, it&#8217;s a cmdlet.  How does this affect the usage of the control functions?  Lets look at my code from my <a href="http://jon.netdork.net/2010/07/08/powershell-and-bits" title="The Geekery; PowerShell and BITS">BITS</a> article, and compare it to what I had.</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #800080;">$images</span> <span style="color: pink;">=</span> <a href="about:blank"><span style="color: #000080;">$_</span></a>.images<br />
<br />
&nbsp; &nbsp; <span style="color: #800080;">$job</span> <span style="color: pink;">=</span> <span style="color: #800080;">$null</span><br />
&nbsp; &nbsp; <span style="color: #800080;">$img_split</span> <span style="color: pink;">=</span> <span style="color: #800080;">$images</span>.Split<span style="color: #000000;">&#40;</span><span style="color: #800000;">'|'</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #0000FF;">for</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$i</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>; <span style="color: #800080;">$i</span> <span style="color: #FF0000;">-lt</span> <span style="color: #800080;">$img_split</span>.Count; <span style="color: #800080;">$i</span><span style="color: pink;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$img_split</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$i</span><span style="color: #000000;">&#93;</span>.Length <span style="color: #FF0000;">-eq</span> <span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">continue</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>

<p>As you can see, I&#8217;m using the continue function inside the array of strings for the images.  If the string value is empty, I skip onto the next one.  This is what the original code looked like:</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #800080;">$images</span> <span style="color: pink;">=</span> <a href="about:blank"><span style="color: #000080;">$_</span></a>.images<br />
&nbsp; &nbsp; <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$images</span>.Length <span style="color: #FF0000;">-eq</span> <span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">continue</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #800080;">$job</span> <span style="color: pink;">=</span> $null</div></td></tr></tbody></table></div>

<p>Whilst the code seems pretty similar, there is one distinct difference.  The first block of code is inside a loop, the second set is not.  Even though you think that <em>ForEach-Object</em> seems like a loop, it&#8217;s a cmdlet that does not behave the same way that a loop does.  How does this affect the behavior of the code?  Badly!  Because there is no loop, the control function looks for the next operation it can operate on.  It turns out that the next function it can operate on is the entire script.  It essentially <strong>kills</strong> the script right where the line is.  This means no processing of other objects in the &#8216;loop&#8217;, no continuing with the code further in the script, no nice handling of anything else in the script.  It&#8217;s done, finished, over.  My hint something wasn&#8217;t behaving right was the fact I should have had several thousand images, and yet I only had about 150.  It took 4 or 5 attempts, as well as various debug statements throughout the code to figure out why this was happening.  After I realized where it was going wrong, a Google search dropped me over to James Manning&#8217;s post <a href="http://blogs.msdn.com/b/jmanning/archive/2007/03/22/powershell-gotcha-foreach-keyword-vs-foreach-object-cmdlet.aspx" title="James Manning; PowerShell gotcha - foreach keyword vs. foreach-object cmdlet">PowerShell gotcha &#8211; foreach keyword vs. foreach-object cmdlet</a>.</p>

<p>So if you ever find yourself in need of an object loop, remember that <em>ForEach-Object</em> isn&#8217;t really a keyword, it&#8217;s a cmdlet, and does not behave the same.</p>

<p>See any mistakes? Want to add your feedback? Leave me a note in the comments, I love to hear from you.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/07/13/powershell-loops-foreach-control-functions/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PowerShell and BITS</title>
		<link>http://jon.netdork.net/2010/07/08/powershell-and-bits?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=powershell-and-bits</link>
		<comments>http://jon.netdork.net/2010/07/08/powershell-and-bits#comments</comments>
		<pubDate>Thu, 08 Jul 2010 20:25:23 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=906</guid>
		<description><![CDATA[Ever had to download a bunch of files from a website, and didn’t want to have to write an HTTP handler for it? This comes up on a regular basis here. We get requests from customers that have transferred from one vendor to another, and want to import all their photos to us. Here is [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F08%2Fpowershell-and-bits">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F08%2Fpowershell-and-bits&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>Ever had to download a bunch of files from a website, and didn’t want to have to write an <acronym title="HyperText Transfer Protocol">HTTP</acronym> handler for it? This comes up on a regular basis here. We get requests from customers that have transferred from one vendor to another, and want to import all their photos to us. Here is how I solve it.</p>

<p><span id="more-906"></span></p>

<h2>What is BITS?</h2>

<p><a href="http://msdn.microsoft.com/en-us/library/aa362708%28VS.85%29.aspx" title="Microsoft MSDN; About BITS">BITS</a>, or <em>Background Intelligent Transfer Service</em>, is a service bundled with Windows that is used to transfer files from websites. It was originally introduced in Windows XP RTM back in October 2001. You may not know it, but your computer uses it all the time if you have <em>Windows Automatic Updates</em> enabled.  It is an intelligent service that asynchronously transfers files, automatically adjusting bandwidth usage, throttling downloads, as bandwidth becomes available.  It can even be used to download files across computer starts.</p>

<h2>How is it useful in PowerShell?</h2>

<p>BITS is really easy to use, a few commands which I’ll show shortly, and you can download a bunch of files quickly, without having to write <acronym title="HyperText Transfer Protocol">HTTP</acronym> handler.  In my case above, I receive text files, with a list of image URLs, that need to be imported.</p>

<p>Here is how to do a very simple, single file, transfer.</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Import<span style="color: pink;">-</span>Module BitsTransfer<br />
<span style="color: #800080;">$job</span> <span style="color: pink;">=</span> Start<span style="color: pink;">-</span>BitsTransfer <span style="color: pink;">-</span>Source http:<span style="color: pink;">//</span>somedomain.com<span style="color: pink;">/</span>somefile.jpg <span style="color: #008080; font-style: italic;">-Destination</span> c:\images\somefile.jpg <span style="color: pink;">-</span>Asynchronous<br />
<span style="color: #0000FF;">while</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$job</span>.JobState.ToString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">'Transferring'</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-or</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$job</span>.JobState.ToString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">'Connecting'</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #008080; font-weight: bold;">Sleep</span> <span style="color: #804000;">3</span><br />
<span style="color: #000000;">&#125;</span><br />
Complete<span style="color: pink;">-</span>BitsTransfer <span style="color: pink;">-</span>BitsJob $job</div></div>

<p>Relatively simple, a few lines of code for a single file.  However, BITS really shines when you’re working with multiple files to download.</p>

<p>As the files I receive are quite often comma-separated values (CSV) files, we can use the rather handy <a href="http://technet.microsoft.com/en-us/library/dd347665.aspx" title="Microsoft TechNet; Import-CSV">Import-CSV</a> function, and we build up from there.</p>

<div class="codecolorer-container posh default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="posh codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Import<span style="color: pink;">-</span>Module BitsTransfer<br />
<span style="color: #800080;">$filedata</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Import-CSV</span> c:\images\import.csv<br />
<span style="color: #800080;">$filedata</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">ForEach-Object</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #800080;">$vin</span> <span style="color: pink;">=</span> <a href="about:blank"><span style="color: #000080;">$_</span></a>.VIN<br />
&nbsp; &nbsp; <span style="color: #800080;">$images</span> <span style="color: pink;">=</span> <a href="about:blank"><span style="color: #000080;">$_</span></a>.Images<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #800080;">$job</span> <span style="color: pink;">=</span> <span style="color: #800080;">$null</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #800000;">&quot;Processing VIN: {0}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$vin</span><br />
&nbsp; &nbsp; <span style="color: #800080;">$img_split</span> <span style="color: pink;">=</span> <span style="color: #800080;">$images</span>.Split<span style="color: #000000;">&#40;</span><span style="color: #800000;">'|'</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #0000FF;">for</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$i</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>; <span style="color: #800080;">$i</span> <span style="color: #FF0000;">-lt</span> <span style="color: #800080;">$img_split</span>.Count; <span style="color: #800080;">$i</span><span style="color: pink;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$img_split</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$i</span><span style="color: #000000;">&#93;</span>.Length <span style="color: #FF0000;">-eq</span> <span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">continue</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #800080;">$outpath</span> <span style="color: pink;">=</span> <span style="color: #800000;">'C:\Images\{0}_{1}.jpg'</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$vin</span><span style="color: pink;">,</span> <span style="color: #800080;">$i</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$job</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #800080;">$job</span> <span style="color: pink;">=</span> Start<span style="color: pink;">-</span>BitsTransfer <span style="color: pink;">-</span>Source <span style="color: #800080;">$img_split</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$i</span><span style="color: #000000;">&#93;</span> <span style="color: #008080; font-style: italic;">-Destination</span> <span style="color: #800080;">$outpath</span> <span style="color: pink;">-</span>Asynchronous<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0000FF;">else</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Add<span style="color: pink;">-</span>BitsFile <span style="color: pink;">-</span>BitsJob <span style="color: #800080;">$job</span> <span style="color: pink;">-</span>Source <span style="color: #800080;">$img_split</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$i</span><span style="color: #000000;">&#93;</span> <span style="color: #008080; font-style: italic;">-Destination</span> <span style="color: #800080;">$outpath</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$job</span> <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">while</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$job</span>.JobState.ToString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">'Transferring'</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-or</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$job</span>.JobState.ToString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">'Connecting'</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-weight: bold;">Sleep</span> <span style="color: #804000;">3</span> &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; Complete<span style="color: pink;">-</span>BitsTransfer <span style="color: pink;">-</span>BitsJob <span style="color: #800080;">$job</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>

<p>This is a little more complicated, but is still pretty simple.  It introduces <em>Add-BitsFile</em> which allows you to add files to an existing job, and a simple <em>ForEach</em> loop to go through an array of URLs.</p>

<p>I&#8217;ve made a few assumptions here, and thrown out all kinds of error handling in favor of a quick code turn around.  For example, the job state of a BITS job can be one of nine options (which you can see <a href="http://msdn.microsoft.com/en-us/library/aa362809(v=VS.85).aspx" title="Microsoft MSDN; BITS Job State">here</a>), but I assume only two.  I&#8217;m also not handling cases where I exceed the number of jobs, but that never happens because I only ever have one job running at a time.  I&#8217;ll probably work on tidying it up a little for other people&#8217;s use, but for now, it&#8217;s just me using it where I work, so the impact of an error is very minimal.</p>

<p>Give it a shot, download some images off of Flickr<sup><a href="http://jon.netdork.net/2010/07/08/powershell-and-bits#footnote_0_906" id="identifier_0_906" class="footnote-link footnote-identifier-link" title="if they are yours, or have Creative Commons license">1</a></sup>, or go a little further, and test it against downloads from Microsoft.</p>

<p>Got any questions? Hints? Tips? Leave them in the comments, I&#8217;d love to hear from you.</p><!-- google_ad_section_end --><ol class="footnotes"><li id="footnote_0_906" class="footnote">if they are yours, or have Creative Commons license</li></ol>]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/07/08/powershell-and-bits/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	
	
	<!-- google ad injected by adsense-optimizer http://www.adsenseoptimizer.de -->
	<div  style="padding:7px; display: block; margin-left: auto; margin-right: auto; text-align: center;"><!-- Ad number: 1 --><script type="text/javascript"><!--
    	 
    	google_ad_client = "pub-5380792458095798"; google_alternate_color = "FFFFFF";
		google_ad_width = 468; google_ad_height = 60;
		google_ad_format = "468x60_as"; google_ad_type = "text";
		google_ad_channel =""; google_color_border = "CCCCCC";
		google_color_link = "2970A6"; google_color_bg = "F7F7F7";
		google_color_text = "555555"; google_color_url = "2970A6";
		google_ui_features = "rc:10"; //--></script>
		<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>	<item>
		<title>Windows 2008, and Hibernation</title>
		<link>http://jon.netdork.net/2010/07/06/windows-2008-and-hibernation?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=windows-2008-and-hibernation</link>
		<comments>http://jon.netdork.net/2010/07/06/windows-2008-and-hibernation#comments</comments>
		<pubDate>Wed, 07 Jul 2010 01:51:18 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=903</guid>
		<description><![CDATA[Whilst driving back from our 4th of July celebrations in San Antonio, I got alerted to a server running low on disk space.&#160; As it hadn’t hit critical, and there was still a fair bit of space left, I decided to wait until I got home.&#160; When I looked at the server, I pulled up [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F06%2Fwindows-2008-and-hibernation">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F07%2F06%2Fwindows-2008-and-hibernation&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p></p><p>Whilst driving back from our 4th of July celebrations in San Antonio, I got alerted to a server running low on disk space.&#160; As it hadn’t hit critical, and there was still a fair bit of space left, I decided to wait until I got home.&#160; When I looked at the server, I pulled up my trusted space analyzer, <a href="http://www.jam-software.com/treesize_free/" target="_blank">TreeSize</a>.</p>  <span id="more-903"></span>  <p><a href="http://jon.netdork.net/wp-content/uploads/2010/07/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" align="right" src="http://jon.netdork.net/wp-content/uploads/2010/07/image_thumb.png" width="244" height="72" /></a>A quick analysis of the drive, and a report showed that there was a hefty chunk of space lost to the WinSXS directory<sup><a href="http://jon.netdork.net/2010/07/06/windows-2008-and-hibernation#footnote_0_903" id="identifier_0_903" class="footnote-link footnote-identifier-link" title="If you&rsquo;ve not read about this, I strongly recommend you do when planning out a Windows 2008 server build">1</a></sup>, and 8GB of <em>Files</em> in the root of C:.&#160; This was a little odd, I know I usually use c:\temp from time to time, but never the root.&#160; To find out what was there, I first had to show hidden and system files.&#160; To do this, go to Tools, then Folder Options, then onto the View tab.&#160; There are 3 options there that we need to change.</p>  <ol>   <li>Change “Hidden files and folders” to “Show hidden files and folders”</li>    <li>Uncheck “Hide extensions for known file types”</li>    <li>Uncheck “Hide protected operating system files (Recommended)”</li> </ol>  <p>I <strong><em>highly</em></strong> recommend doing 2 all the time, you never know when somebody might sent a .txt.exe file<sup><a href="http://jon.netdork.net/2010/07/06/windows-2008-and-hibernation#footnote_1_903" id="identifier_1_903" class="footnote-link footnote-identifier-link" title="A very old trick from virus/malware creators">2</a></sup>.&#160; Changing 3 will prompt that it isn’t recommended, but do it anyway, the files I was having issues with were still hidden after changing the first two.</p>  <p>After making these changes, two files appeared that were the culprits to the lost disk space.&#160; <em>Pagefile.sys</em> and <em>Hiberfil.sys</em>.&#160; I’ll leave the explanation of the <em><a title="TechNet; What is the Page File for Anyway?" href="http://blogs.technet.com/b/askperf/archive/2007/12/14/what-is-the-page-file-for-anyway.aspx" target="_blank">Pagefile</a></em> to the experts.&#160; <em>Hiberfil.sys</em> is a file that is used to handle the state of memory, and running applications when you hibernate your computer.&#160; </p>  <h2>What is hibernation?</h2>  <p>Hibernation is a heavy sleep state for computers where all the running processes are frozen, the memory is locked, and all the states are saved into that file, then the computer is powered down.&#160; When the computer is turned back on, the operating system sees this <em>state</em> file, and starts to reload everything from there.&#160; This makes it appear like the computer was never even turned off.&#160; The applications are resumed, everything is back to the state it was before hibernation was kicked off.</p>  <h2>Why is that bad?</h2>  <p>Generally speaking, it isn’t.&#160; In fact, it’s a great thing for home computers.&#160; When you’re done reading your email at night, if you hibernate your computer, and hop into bed, your computer will be off, saving power.&#160; However this isn’t so good for servers.&#160; In 95% of cases, servers don’t ever need to hibernate.&#160; They usually have tasks, and operations that they need to run all the time, which means putting them in a state of hibernation is a bad thing as the tasks won’t be run.</p>  <h2>How do you stop this?</h2>  <p>Usually, servers have this feature turned off, but for some reason this particular one had it enabled.&#160; I’ve done some looking around, and it seems it’s may have actually been a default option to have it enabled, but for some (<em>lucky</em>) reason a handful of our other servers don’t have it on.&#160; In earlier versions of Windows, disabling the hibernation option was a case of removing a check mark from a box.&#160; This was done in the <em>Control Panel</em> under <em>Power Options</em>, and the <em>Hibernate</em> tab.&#160; However, in Windows 2008 this option was removed, and you now have to use a command line to manage this advanced option.</p>  <p></p>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;powercfg –hibernate off</div></div>

<p></p>  <p>Within about 10 seconds of issuing that command, the <em>Hiberfil.sys </em>file disappeared, and I recovered 4GB of disk space.&#160; You can read more about the <em>powercfg</em> command <a title="TechNet; Powercfg Command-Line options" href="http://technet.microsoft.com/en-us/library/cc748940%28WS.10%29.aspx" target="_blank">here</a>.</p><!-- google_ad_section_end --><ol class="footnotes"><li id="footnote_0_903" class="footnote">If you’ve not read about this, I strongly recommend you do when planning out a Windows 2008 server build</li><li id="footnote_1_903" class="footnote">A very old trick from virus/malware creators</li></ol>]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/07/06/windows-2008-and-hibernation/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Configuration Management (Part II): Setting up SVN</title>
		<link>http://jon.netdork.net/2010/06/28/configuration-management-part-ii-setting-up-svn?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=configuration-management-part-ii-setting-up-svn</link>
		<comments>http://jon.netdork.net/2010/06/28/configuration-management-part-ii-setting-up-svn#comments</comments>
		<pubDate>Tue, 29 Jun 2010 01:12:17 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Sys Admin]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=885</guid>
		<description><![CDATA[In part II of my walk through on configuration management, I&#8217;m going to work on setting up Subversion (SVN). SVN is a version control system and, just like any version control system, is used to keep track of changes. The most common use is in a development environment with teams of developers so that everybody [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F06%2F28%2Fconfiguration-management-part-ii-setting-up-svn">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F06%2F28%2Fconfiguration-management-part-ii-setting-up-svn&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>In part II of my walk through on configuration management, I&#8217;m going to work on setting up <a href="http://subversion.apache.org/" title="Apache Subversion">Subversion</a> (<acronym title="Subversion">SVN</acronym>).  <acronym title="Subversion">SVN</acronym> is a version control system and, just like any version control system, is used to keep track of changes.  The most common use is in a development environment with teams of developers so that everybody can work on the code, without having to worry about other people&#8217;s work.  It&#8217;s obviously not limited there, it can be used as a form of backup, keeping a track of what you&#8217;ve changed, and when.  This is how we&#8217;ll be using it for our configuration management.</p>

<p><span id="more-885"></span></p>

<h2>Installing <acronym title="Subversion">SVN</acronym></h2>

<p>I&#8217;m going to make the assumption you know how to install Linux.  If not, there are plenty of guides on doing so around the internet, and most come with a pretty easy to use installer.  With that said, I am starting this off with a completely blank slate.  I installed <a href="http://www.debian.org" title="Debian">Debian</a> 5.0.4 inside a <a href="http://www.virtualbox.org" title="Oracle VirtualBox">VirtualBox</a> instance.  I&#8217;ll be installing <acronym title="Subversion">SVN</acronym> on the same server for now, but it could be installed anywhere that supports it.</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> subversion</div></div>

<p>The above command needs to be run as <em>root</em>.  You can do the same as a normal user as long as you prefix the command with <em>sudo</em>.</p>

<h2>Creating the repository</h2>

<p>Next step is to create the repository we&#8217;ll be working with for the configurations.</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svn</span><br />
<span style="color: #c20cb9; font-weight: bold;">svnadmin</span> create <span style="color: #660033;">--fs-type</span> fsfs <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>thebe_config</div></div>

<p>You can name the repository whatever you want, I used thebe_config, <a href="http://www.solarviews.com/eng/thebe.htm" title="Jupiter's Moon; Thebe">Thebe</a> is the name of the server, and the second part is obvious.  Next we&#8217;ll create a group for those that will be working on the <acronym title="Subversion">SVN</acronym> project, and add the users.  As it&#8217;s only me, that&#8217;s easy&#8230;</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">groupadd subversion<br />
addgroup jonathan subversion</div></div>

<p>That&#8217;s the basic setup done&#8230; Now onto more fun stuff.</p>

<h2>Using the repository</h2>

<p>Generally speaking, <acronym title="Subversion">SVN</acronym> requires you to import a project, and checkout in another location.  For example, a basic initial import, and check out would look something like this:</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> my_test<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;First import test&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> my_test<span style="color: #000000; font-weight: bold;">/</span>test_file.txt<br />
<span style="color: #c20cb9; font-weight: bold;">svn</span> import <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;This is the initial setup&quot;</span> my_test<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>srv<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>thebe_config<span style="color: #000000; font-weight: bold;">/</span>trunk<br />
<span style="color: #c20cb9; font-weight: bold;">svn</span> checkout <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>srv<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>thebe_config<span style="color: #000000; font-weight: bold;">/</span>trunk newproject</div></div>

<p>If you tried to checkout the project on-top of the existing code you already put up, you&#8217;d get an error like this:</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn</span> checkout <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>srv<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>thebe_config<span style="color: #000000; font-weight: bold;">/</span>trunk my_test<br />
snv: Failed to add <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">'my_test/test_file.txt'</span>: an unversioned <span style="color: #c20cb9; font-weight: bold;">file</span> of the same name already exists</div></div>

<p>This isn&#8217;t so good for us, because we can hardly delete /etc.  That being said, <acronym title="Subversion">SVN</acronym> has it covered, with what they document as an &#8220;<a href="http://subversion.apache.org/faq.html#in-place-import" title="SVN FAQ; In-Place import">in-place &#8216;import&#8217;</a>&#8220;.  The really cool thing about this, they document exactly what we&#8217;re trying to do, version-control the /etc structure.  So instead of importing /etc, we fake it.</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">--parents</span> <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>srv<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>thebe_config<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>etc<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<br />
<span style="color: #c20cb9; font-weight: bold;">svn</span> checkout <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>srv<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>thebe_config<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>etc .<br />
<span style="color: #c20cb9; font-weight: bold;">svn</span> add <span style="color: #000000; font-weight: bold;">*</span><br />
<span style="color: #c20cb9; font-weight: bold;">svn</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Initial check-in of /etc&quot;</span></div></div>

<p>Whilst it&#8217;s not documented in the <acronym title="Frequently Asked Questions">FAQ</acronym> there, the <em>&#8211;parents</em> option is similar to that of the normal <em>mkdir</em>, it recursively creates the directory structure down to the child we&#8217;re making.  In this case, trunk/etc.  After the last 2 commands, you should see a stream of data zip by you.  In the above example, I added the entire content of /etc, you can restrict it to certain directories if you want, say apache2, or samba, or you can go the whole way, and do the above.</p>

<p>Now it&#8217;s all checked in, lets see what it looks like:</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svnlook</span> <span style="color: #c20cb9; font-weight: bold;">tree</span> <span style="color: #000000; font-weight: bold;">/</span>srv<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>thebe_config <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">more</span></div></div>

<p>After that, you should see a nice structured view of your checked in directory structure.  </p>

<h2>A gotcha with <acronym title="Subversion">SVN</acronym></h2>

<p>Before we go messing with these files, and testing everything is working well, we need to note something about <acronym title="Subversion">SVN</acronym>, that is important to the /etc directory structure.  File permissions.  <acronym title="Subversion">SVN</acronym> does <strong>not</strong> record file permissions.  This is an issue for some parts of the /etc directory, such as the shadow file, or the group file, or that htpasswd file you created to restrict users access.</p>

<p><acronym title="Subversion">SVN</acronym> allows you to store properties information along side each file, this file can contain all kinds of information, such as copyright data, license information, and all that fun stuff<sup><a href="http://jon.netdork.net/2010/06/28/configuration-management-part-ii-setting-up-svn#footnote_0_885" id="identifier_0_885" class="footnote-link footnote-identifier-link" title="You can read more on SVN properties here">1</a></sup>.  A crafty contributor too advantage of that, and created a script called <a href="http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/asvn" title="SVN Contrib; ASVN">asvn</a>.  This script is a wrapper around the usual <em>svn</em> command, and executes some work either before a commit, or after a checkout.  So we need to grab a copy of this script:</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.apache.org<span style="color: #000000; font-weight: bold;">/</span>repos<span style="color: #000000; font-weight: bold;">/</span>asf<span style="color: #000000; font-weight: bold;">/</span>subversion<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>contrib<span style="color: #000000; font-weight: bold;">/</span>client-side<span style="color: #000000; font-weight: bold;">/</span>asvn <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>asvn<br />
<span style="color: #c20cb9; font-weight: bold;">chmod</span> a+rx <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>asvn<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<br />
asvn commit</div></div>

<p>After the last command, you&#8217;ll see a bunch of stuff zoom past, and you will be prompted for a commit message, I did &#8220;permissions fixup&#8221;, and hit CTRL X and yes.  More stuff zooms by, and you should see a message appear that tells you the revision number has incremented.  Now to see if it worked&#8230;</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn</span> proplist <span style="color: #660033;">--verbose</span> group<br />
Properties on <span style="color: #ff0000;">'group'</span>:<br />
&nbsp; <span style="color: #c20cb9; font-weight: bold;">file</span>:permissions &nbsp;: <span style="color: #007800;">mode</span>=<span style="color: #000000;">644</span> <span style="color: #007800;">user</span>=root<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">group</span>=root<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>

<p>Excellent, now the last test, see what the checkout looks like, and see if it matches&#8230;</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>thebe_config<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<br />
asvn checkout <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>srv<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>thebe_config<span style="color: #000000; font-weight: bold;">/</span>trunk <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>thebe_config</div></div>

<p>More scrolling of lots of boring text, but you should notice stuff like &#8220;checking {somefile} for symlinks&#8221;.  This is the asvn script doing it&#8217;s work, and rebuilding permissions and symlinks.  In my example, I&#8217;d checked in everything, which includes the precious &#8220;shadow&#8221; file (I&#8217;d not recommend adding that one, add it to the svn:ignore list).  I did so to provide a sample file with differing permissions.  The original file is locked down to specific user and group:</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>shadow<br />
<span style="color: #660033;">-rw-r-----</span> <span style="color: #000000;">1</span> root shadow <span style="color: #000000;">738</span> <span style="color: #000000;">2010</span>-06-<span style="color: #000000;">27</span> <span style="color: #000000;">19</span>:<span style="color: #000000;">42</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>shadow<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn</span> proplist <span style="color: #660033;">--verbose</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>shadow<br />
Properties on <span style="color: #ff0000;">'/etc/shadow'</span>:<br />
&nbsp; <span style="color: #c20cb9; font-weight: bold;">file</span>:permissions : <span style="color: #007800;">mode</span>=<span style="color: #000000;">640</span> <span style="color: #007800;">user</span>=root<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">group</span>=shadow<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">42</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>

<p>Lines starting with the $ are the commands I executed.  The rest is the response from the server.  As you can see, the permissions match.<sup><a href="http://jon.netdork.net/2010/06/28/configuration-management-part-ii-setting-up-svn#footnote_1_885" id="identifier_1_885" class="footnote-link footnote-identifier-link" title="Not sure how the -rw-r&amp;#8212;&amp;#8211; matches 640? I highly recommend checking out the excellent StandAlone SysAdmin&amp;#8217;s great post on numeric unix permissions">2</a></sup>.  Now the results in our test checkout&#8230;</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>thebe_config<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> shadow<br />
<span style="color: #660033;">-rw-r-----</span> <span style="color: #000000;">1</span> root shadow <span style="color: #000000;">738</span> <span style="color: #000000;">2010</span>-06-<span style="color: #000000;">27</span> <span style="color: #000000;">20</span>:06 shadow</div></div>

<p>Permissions match, size matches, so it looks like <acronym title="Subversion">SVN</acronym> now has a good copy of the file properties, and the version I have checked in is the same as the one I have in /etc.  As a side note, it should be worth remembering that some of the permissions cannot be set by anybody but root, so a lot of this work will probably require root, or sudo access.  That being said, you&#8217;re editing /etc, so you should already be doing that.</p>

<h2>Wrap-up</h2>

<p>So far, we&#8217;ve covered why we want to use a version control repository for our configurations.  We&#8217;ve also setup <acronym title="Subversion">SVN</acronym>, and got the basics going, including extended <acronym title="Subversion">SVN</acronym> to include extra data to handle file properties.  Next up is the basics of using <acronym title="Subversion">SVN</acronym>, and how it&#8217;ll be helping us out here in /etc and configuration land.</p>

<p>If you see any errors, or have any suggestions, feel free to leave them in the comments.  Want me to write about something else? Drop me an idea, and I&#8217;ll see what I can do.</p><!-- google_ad_section_end --><ol class="footnotes"><li id="footnote_0_885" class="footnote">You can read more on <acronym title="Subversion">SVN</acronym> properties <a href="http://svnbook.red-bean.com/en/1.0/ch07s02.html" title="SVN; Properties">here</a></li><li id="footnote_1_885" class="footnote">Not sure how the -rw-r&#8212;&#8211; matches 640? I highly recommend checking out the excellent StandAlone SysAdmin&#8217;s great post on <a href="http://www.standalone-sysadmin.com/blog/2010/06/setting-unix-file-permissions-numerically/" title="StandAlone SysAdmin; Setting Unix File Permissions Numerically">numeric unix permissions</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/06/28/configuration-management-part-ii-setting-up-svn/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Configuration Management (Part I): Introduction</title>
		<link>http://jon.netdork.net/2010/06/20/configuration-management-part-i-introduction?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=configuration-management-part-i-introduction</link>
		<comments>http://jon.netdork.net/2010/06/20/configuration-management-part-i-introduction#comments</comments>
		<pubDate>Mon, 21 Jun 2010 01:22:19 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=876</guid>
		<description><![CDATA[I&#8217;ve been asked to write a post on configuration management, and version control by a friend, Steven Klassen. Instead of a single post, I&#8217;m going to break this into several posts as some parts might be unimportant to some, and they can easily skip a whole post. I&#8217;ll be posting this over a few days, [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F06%2F20%2Fconfiguration-management-part-i-introduction">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F06%2F20%2Fconfiguration-management-part-i-introduction&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>I&#8217;ve been asked to write a post on configuration management, and version control by a friend, <a href="http://www.stevenklassen.com/" title="Steven Klassen">Steven Klassen</a>.  Instead of a single post, I&#8217;m going to break this into several posts as some parts might be unimportant to some, and they can easily skip a whole post.  I&#8217;ll be posting this over a few days, so stay tuned.  If you&#8217;re not subscribed to my <a href="http://feeds.feedburner.com/TheGeekery" title="The Geekery; RSS Feed"><acronym title="Really Simple Syndication">RSS</acronym> feed</a>, now would be a great time.</p>

<p><span id="more-876"></span></p>

<h2>The Request</h2>

<p>Earlier today, Steven asked if I used any form of version control.  It was a leading question, straight into &#8220;dev only or system files&#8221;?  His questions were targeted, he was searching for guidance<sup><a href="http://jon.netdork.net/2010/06/20/configuration-management-part-i-introduction#footnote_0_876" id="identifier_0_876" class="footnote-link footnote-identifier-link" title="At least that&amp;#8217;s how I perceived it">1</a></sup>.  Another question or two later, and it boils down to this:</p>

<ul>
<li>Do you use version control for system files?</li>
<li>Files like domain zone files?</li>
<li>What about multi-user environments?</li>
<li>Can you write it up?</li>
</ul>

<p>My take away on the questions boils down to two things; configuration management, and backups.  Anybody that has managed any type of system has, at some point, messed up the configuration file, and forgotten what they did to get there in the first place.  Those who have been at it a while will usually do a quick copy before they do any modifications.  But, as Steven found out in the past, best laid plans can be foiled by a <a href="http://www.stevenklassen.com/2010/06/16/murphy/" title="Steven Klassen; Murphy">simple typo</a>. </p>

<h2>Version Control</h2>

<p>This is what version control is all about.  It acts as a backup, whilst keeping a running history of what you did between changes.  Version control, or revision control as it&#8217;s also known, is big business.  Anywhere you find a big name development company, you&#8217;ll find they&#8217;ve probably developed a revision control system to go with whatever they&#8217;re offering.  Take a look at <a href="http://en.wikipedia.org/wiki/Comparison_of_revision_control_software" title="Wikipedia; Comparison of revision control software">this</a> Wikipedia entry comparing just a handful of them.</p>

<h2>Configuration Management and Version Control</h2>

<p>You don&#8217;t have to be a genius to figure out how useful version control can be for configuration management, but in case your brain often goes off to lala land like <a href="http://twitter.com/j_angliss/status/16407172868" title="Twitter; j_angliss">mine</a>, here is a run down on a few reasons you should really consider using it&#8230;</p>

<ul>
<li>What did I just change again? And why is that service not starting any more? Oh hell&#8230;</li>
<li>6 months down the road, can you figure out <em>why</em> you changed that line to Apache to start 10 daemons instead of 5? No? Most version control systems allow you to add comments to your commits.</li>
<li>As above, but why did Fred in your team change that entry back down to 7 a week later?</li>
<li>In the words of Homer&#8230; <strong>Doh!!</strong> I wasn&#8217;t supposed to delete/overwrite that file!</li>
</ul>

<p>So, there are 4 obvious cases as to why you&#8217;d want to use version control.</p>

<h2>The Breakdown</h2>

<p>As I said at the beginning, I&#8217;ll be breaking this down into several parts.  I expect them to be something along these lines:</p>

<ul>
<li>Introduction</li>
<li>Setting up <acronym title="Subversion">SVN</acronym> and the base repository</li>
<li>Using your repository</li>
<li>Educating your team members</li>
<li>Maintenance and monitoring</li>
<li>Conclusion, and follow-up ideas.</li>
</ul>

<p>If you&#8217;re interested, keep an eye open for the rest of the series.  If not, send me something you&#8217;d like to see me write about.  I&#8217;m open to suggestions, and will probably butcher anything you can throw at me.</p><!-- google_ad_section_end --><ol class="footnotes"><li id="footnote_0_876" class="footnote">At least that&#8217;s how I perceived it</li></ol>]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/06/20/configuration-management-part-i-introduction/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Massive Uptimes, or the failure of them&#8230;</title>
		<link>http://jon.netdork.net/2010/06/18/massive-uptimes-or-the-failure-of-them?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=massive-uptimes-or-the-failure-of-them</link>
		<comments>http://jon.netdork.net/2010/06/18/massive-uptimes-or-the-failure-of-them#comments</comments>
		<pubDate>Sat, 19 Jun 2010 04:39:26 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[SysAdmin]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=872</guid>
		<description><![CDATA[The Nubby Admin has a great post on uptimes, and the old fascination of having a large uptime1. Okay, you can get your minds out the gutter now, not that kind of up time. We&#8217;re talking servers here. The post covers a hidden fear, and the goods and bads of large server uptimes. A good [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F06%2F18%2Fmassive-uptimes-or-the-failure-of-them">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F06%2F18%2Fmassive-uptimes-or-the-failure-of-them&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly&amp;hashtags=SysAdmin" height="61" width="50" />
			</a>
		</div><p><a href="http://thenubbyadmin.com/" title="The Nubby Admin">The Nubby Admin</a> has a <strong>great</strong> <a href="http://thenubbyadmin.com/2010/06/16/epic-uptime-bragging-rights-or-epic-fail/?utm_source=TheGeekery&amp;utm_medium=web&amp;utm_campaign=epic-uptime-bragging-rights-or-epic-fail" title="The Nubby Admin; Epic Uptime – Bragging Rights or Epic Fail?">post</a> on uptimes, and the old fascination of having a large uptime<sup><a href="http://jon.netdork.net/2010/06/18/massive-uptimes-or-the-failure-of-them#footnote_0_872" id="identifier_0_872" class="footnote-link footnote-identifier-link" title="Netcraft even has a page dedicated to it">1</a></sup>.  Okay, you can get your minds out the gutter now, not that kind of <em>up</em> time.  We&#8217;re talking servers here.  </p>

<p>The post covers a hidden fear, and the goods and bads of large server uptimes.  A good read, and one you should look at if you&#8217;re watching your server rolling over into the third year of being running.  I get a mention (well more of a quote), and seem to fall in with the general crowd, large server uptimes are generally bad.</p>

<p>Go read, enjoy, learn something new from the great minds Wesley is surrounding himself with (myself excluded).</p><!-- google_ad_section_end --><ol class="footnotes"><li id="footnote_0_872" class="footnote">Netcraft even has a <a href="http://uptime.netcraft.com/" title="Netcraft; Uptime">page</a> dedicated to it</li></ol>]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/06/18/massive-uptimes-or-the-failure-of-them/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
