<?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>Richards Blog</title>
	<atom:link href="http://www.rn.co.za/html/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.rn.co.za/html</link>
	<description>My life in SD</description>
	<lastBuildDate>Sun, 05 Sep 2010 17:50:00 +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>Twitter Weekly Updates for 2010-09-05</title>
		<link>http://www.rn.co.za/html/?p=241</link>
		<comments>http://www.rn.co.za/html/?p=241#comments</comments>
		<pubDate>Sun, 05 Sep 2010 17:50:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=241</guid>
		<description><![CDATA[Having fun with meetings # Anyone played with Jesus-Firmware http://bit.ly/bdVgfu #adsl #help # Anyone else ever have copper corrosion on their DSL end point, trying to work something out # bunnies cuddly or nutritious # I NEED COFFEE - Power is out like everywhere # Any suggestions for a good aircon installation company - Durban [...]]]></description>
			<content:encoded><![CDATA[<ul class="aktt_tweet_digest">
<li>Having fun with meetings <a href="http://twitter.com/richardniemand/statuses/22509930438" class="aktt_tweet_time">#</a></li>
<li>Anyone played with Jesus-Firmware <a href="http://bit.ly/bdVgfu" rel="nofollow">http://bit.ly/bdVgfu</a> #<a href="http://search.twitter.com/search?q=%23adsl" class="aktt_hashtag">adsl</a> #help <a href="http://twitter.com/richardniemand/statuses/22516127562" class="aktt_tweet_time">#</a></li>
<li>Anyone else ever have copper corrosion on their DSL end point, trying to work something out <a href="http://twitter.com/richardniemand/statuses/22517209374" class="aktt_tweet_time">#</a></li>
<li>bunnies cuddly or nutritious <a href="http://twitter.com/richardniemand/statuses/22590770593" class="aktt_tweet_time">#</a></li>
<li>I NEED COFFEE - Power is out like everywhere <a href="http://twitter.com/richardniemand/statuses/22592306148" class="aktt_tweet_time">#</a></li>
<li>Any suggestions for a good aircon installation company - Durban North <a href="http://twitter.com/richardniemand/statuses/22617932474" class="aktt_tweet_time">#</a></li>
<li>I&#039;ve sent 4000 IMs using @<a href="http://twitter.com/digsby" class="aktt_username">digsby</a>! <a href="http://bit.ly/r2d24u" rel="nofollow">http://bit.ly/r2d24u</a> <a href="http://twitter.com/richardniemand/statuses/22704108148" class="aktt_tweet_time">#</a></li>
<li>Thanks Man - Gaslight Anthem rocks  @<a href="http://twitter.com/Duncan" class="aktt_username">Duncan</a> and @<a href="http://twitter.com/Vaughan" class="aktt_username">Vaughan</a> <a href="http://twitter.com/richardniemand/statuses/22790075274" class="aktt_tweet_time">#</a></li>
</ul>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;submitHeadline=Twitter+Weekly+Updates+for+2010-09-05&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;title=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;title=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;title=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;title=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;title=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;T=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;title=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;title=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Twitter+Weekly+Updates+for+2010-09-05+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D241&amp;t=Twitter+Weekly+Updates+for+2010-09-05" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=241</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Updates for 2010-08-30</title>
		<link>http://www.rn.co.za/html/?p=240</link>
		<comments>http://www.rn.co.za/html/?p=240#comments</comments>
		<pubDate>Mon, 30 Aug 2010 05:50:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=240</guid>
		<description><![CDATA[Geeking out with PowerShell # Bookmark It]]></description>
			<content:encoded><![CDATA[<ul class="aktt_tweet_digest">
<li>Geeking out with PowerShell <a href="http://twitter.com/richardniemand/statuses/22457731709" class="aktt_tweet_time">#</a></li>
</ul>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;submitHeadline=Twitter+Updates+for+2010-08-30&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;title=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;title=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;title=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;title=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;title=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;T=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;title=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;title=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Twitter+Updates+for+2010-08-30+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D240&amp;t=Twitter+Updates+for+2010-08-30" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=240</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VirtualBox List Installed VMs</title>
		<link>http://www.rn.co.za/html/?p=236</link>
		<comments>http://www.rn.co.za/html/?p=236#comments</comments>
		<pubDate>Sun, 29 Aug 2010 18:44:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[COM Objects]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=236</guid>
		<description><![CDATA[A cool feature of VirtualBox is the COM Objects that it exposes for use with external applications such as PowerShell. I am still playing around with the basics here so bear with me. My first challenge for myself was to get a list of all the installed VMS on my computer using the VirtualBox COM Object. This [...]]]></description>
			<content:encoded><![CDATA[<p>A cool feature of VirtualBox is the COM Objects that it exposes for use with external applications such as PowerShell. I am still playing around with the basics here so bear with me.</p>
<p>My first challenge for myself was to get a list of all the installed VMS on my computer using the VirtualBox COM Object. This was made simple with PowerShell thanks to the <strong>Get-Member</strong> (gm) command, which enumerates all the methods and properties of any object (in this case the VirtualBox.VirtualBox object).</p>
<p>To get a list of all the methods and properties available I ran this command.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">New-Object</span> <span style="color: #008080; font-style: italic;">-ComObject</span> VirtualBox.VirtualBox <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">gm</span></pre></div></div>

<p>Which gave me the following back.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">   TypeName: System.__ComObject<span style="color: #008000;">#{3f36e024-7fed-4f20-a02c-9158a82b44e6}</span>
&nbsp;
Name                        MemberType Definition
<span style="color: pink;">----</span>                        <span style="color: pink;">----------</span> <span style="color: pink;">----------</span>
CheckFirmwarePresent        Method     int CheckFirmwarePresent <span style="color: #000000;">&#40;</span>FirmwareType<span style="color: pink;">,</span>...
CreateAppliance             Method     IAppliance CreateAppliance <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
CreateDHCPServer            Method     IDHCPServer CreateDHCPServer <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
CreateHardDisk              Method     IMedium CreateHardDisk <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> string<span style="color: #000000;">&#41;</span>
CreateLegacyMachine         Method     IMachine CreateLegacyMachine <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> s...
CreateMachine               Method     IMachine CreateMachine <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> string<span style="color: pink;">,</span>...
CreateSharedFolder          Method     void CreateSharedFolder <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> string...
FindDHCPServerByNetworkName Method     IDHCPServer FindDHCPServerByNetworkName...
FindDVDImage                Method     IMedium FindDVDImage <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
FindFloppyImage             Method     IMedium FindFloppyImage <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
FindHardDisk                Method     IMedium FindHardDisk <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
FindMachine                 Method     IMachine FindMachine <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
GetDVDImage                 Method     IMedium GetDVDImage <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
GetExtraData                Method     string GetExtraData <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
GetExtraDataKeys            Method     SAFEARRAY<span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span> GetExtraDataKeys <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
GetFloppyImage              Method     IMedium GetFloppyImage <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
GetGuestOSType              Method     IGuestOSType GetGuestOSType <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
GetHardDisk                 Method     IMedium GetHardDisk <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
GetMachine                  Method     IMachine GetMachine <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
OpenDVDImage                Method     IMedium OpenDVDImage <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> string<span style="color: #000000;">&#41;</span>
OpenExistingSession         Method     void OpenExistingSession <span style="color: #000000;">&#40;</span>ISession<span style="color: pink;">,</span> str...
OpenFloppyImage             Method     IMedium OpenFloppyImage <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> string<span style="color: #000000;">&#41;</span>
OpenHardDisk                Method     IMedium OpenHardDisk <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> AccessMod...
OpenMachine                 Method     IMachine OpenMachine <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
OpenRemoteSession           Method     IProgress OpenRemoteSession <span style="color: #000000;">&#40;</span>ISession<span style="color: pink;">,</span> ...
OpenSession                 Method     void OpenSession <span style="color: #000000;">&#40;</span>ISession<span style="color: pink;">,</span> string<span style="color: #000000;">&#41;</span>
RegisterCallback            Method     void RegisterCallback <span style="color: #000000;">&#40;</span>IVirtualBoxCallb...
RegisterMachine             Method     void RegisterMachine <span style="color: #000000;">&#40;</span>IMachine<span style="color: #000000;">&#41;</span>
RemoveDHCPServer            Method     void RemoveDHCPServer <span style="color: #000000;">&#40;</span>IDHCPServer<span style="color: #000000;">&#41;</span>
RemoveSharedFolder          Method     void RemoveSharedFolder <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
SetExtraData                Method     void SetExtraData <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> string<span style="color: #000000;">&#41;</span>
UnregisterCallback          Method     void UnregisterCallback <span style="color: #000000;">&#40;</span>IVirtualBoxCal...
UnregisterMachine           Method     IMachine UnregisterMachine <span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span>
WaitForPropertyChange       Method     void WaitForPropertyChange <span style="color: #000000;">&#40;</span>string<span style="color: pink;">,</span> uin...
DHCPServers                 Property   SAFEARRAY<span style="color: #000000;">&#40;</span>IDHCPServer<span style="color: #000000;">&#41;</span> DHCPServers <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>...
DVDImages                   Property   SAFEARRAY<span style="color: #000000;">&#40;</span>IMedium<span style="color: #000000;">&#41;</span> DVDImages <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
FloppyImages                Property   SAFEARRAY<span style="color: #000000;">&#40;</span>IMedium<span style="color: #000000;">&#41;</span> FloppyImages <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
GuestOSTypes                Property   SAFEARRAY<span style="color: #000000;">&#40;</span>IGuestOSType<span style="color: #000000;">&#41;</span> GuestOSTypes <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>...
HardDisks                   Property   SAFEARRAY<span style="color: #000000;">&#40;</span>IMedium<span style="color: #000000;">&#41;</span> HardDisks <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
HomeFolder                  Property   string HomeFolder <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
Host                        Property   IHost Host <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
Machines                    Property   SAFEARRAY<span style="color: #000000;">&#40;</span>IMachine<span style="color: #000000;">&#41;</span> Machines <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
PackageType                 Property   string PackageType <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
PerformanceCollector        Property   IPerformanceCollector PerformanceCollec...
ProgressOperations          Property   SAFEARRAY<span style="color: #000000;">&#40;</span>IProgress<span style="color: #000000;">&#41;</span> ProgressOperations...
Revision                    Property   uint Revision <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
SettingsFilePath            Property   string SettingsFilePath <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span>
SharedFolders               Property   SAFEARRAY<span style="color: #000000;">&#40;</span>ISharedFolder<span style="color: #000000;">&#41;</span> SharedFolders ...
SystemProperties            Property   ISystemProperties SystemProperties <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>...
Version                     Property   string Version <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>get<span style="color: #000000;">&#125;</span></pre></div></div>

<p>From there I made use of the <strong>Machines</strong> property to get a collection of all the virtual machines on my computer, the finished script looks something like this.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># Check if VBox is installed</span>
<span style="color: #0000FF;">if</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Test-Path</span> <span style="color: #008080; font-style: italic;">-Path</span> hklm:\SOFTWARE\Oracle\VirtualBox<span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$false</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Virtual Box is not installed!&quot;</span>
    Exit
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># Create the VBox COM Object</span>
<span style="color: #800080;">$comVB</span>   <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> <span style="color: #008080; font-style: italic;">-ComObject</span> VirtualBox.VirtualBox
<span style="color: #800080;">$arrVMS</span>  <span style="color: pink;">=</span> <span style="color: #800080;">$comVB</span>.Machines
<span style="color: #800080;">$counter</span> <span style="color: pink;">=</span> <span style="color: #000000;">1</span>
&nbsp;
<span style="color: #008000;"># Count found VMs</span>
<span style="color: #0000FF;">if</span><span style="color: #000000;">&#40;</span> <span style="color: #800080;">$arrVMS</span>.Length <span style="color: #FF0000;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;There are no VMs installed&quot;</span>
    Exit
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># List the names of the VMs</span>
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span> <span style="color: #800080;">$vm</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$arrVMS</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$info</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;VM&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$counter</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;: &quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$vm</span>.Name <span style="color: pink;">+</span> <span style="color: #800000;">&quot; (&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$vm</span>.OSTypeId <span style="color: pink;">+</span> <span style="color: #800000;">&quot;)&quot;</span>
    <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800080;">$info</span>
    <span style="color: #800080;">$counter</span><span style="color: pink;">++</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The following was written to my console.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">VM1: Server <span style="color: #000000;">2008</span> Base <span style="color: #000000;">&#40;</span>Windows2008<span style="color: #000000;">&#41;</span></pre></div></div>

<p>Just checking to ensure this is valid...</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-291.png" rel="lightbox[236]"><img class="aligncenter size-medium wp-image-237" title="2010-08-29" src="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-291-300x127.png" alt="" width="300" height="127" /></a></p>
<p>I am starting to like PowerShell <img src='http://www.rn.co.za/html/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;submitHeadline=VirtualBox+List+Installed+VMs&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;title=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;title=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;title=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;title=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;title=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;T=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;title=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;title=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+VirtualBox+List+Installed+VMs+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D236&amp;t=VirtualBox+List+Installed+VMs" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=236</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Listing all COM Objects with PowerShell</title>
		<link>http://www.rn.co.za/html/?p=232</link>
		<comments>http://www.rn.co.za/html/?p=232#comments</comments>
		<pubDate>Sun, 29 Aug 2010 18:27:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[COM Objects]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=232</guid>
		<description><![CDATA[I am playing around with PowerShell at the moment and wanted to see all the available COM Objects that I can invoke. I found this useful thread on Vista Forums which gave me the following script. gci HKLM:\Software\Classes -ea 0 &#124; ? &#123;$_.PSChildName -match '^\w+\.\w+$' -and &#40;gp &#34;$($_.PSPath)\CLSID&#34; -ea 0&#41;&#125; &#124; ft PSChildName This is all good, [...]]]></description>
			<content:encoded><![CDATA[<p>I am playing around with PowerShell at the moment and wanted to see all the available COM Objects that I can invoke. I found this useful thread on <strong><a href="http://www.vistax64.com/powershell/91583-there-any-script-get-list-com-objects-computer.html">Vista Forums</a></strong> which gave me the following script.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">gci</span> HKLM:\Software\Classes <span style="color: pink;">-</span>ea <span style="color: #000000;">0</span> <span style="color: pink;">|</span> <span style="color: pink;">?</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.PSChildName <span style="color: #FF0000;">-match</span> <span style="color: #800000;">'^\w+\.\w+$'</span> <span style="color: #FF0000;">-and</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">gp</span> <span style="color: #800000;">&quot;$($_.PSPath)\CLSID&quot;</span> <span style="color: pink;">-</span>ea <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">ft</span> PSChildName</pre></div></div>

<p>This is all good, but I don't like all the shorthand (well not at the moment as I am trying to learn how to use PowerShell properly anyway).</p>
<p>I took a few seconds and making use of the <strong>Get-Alias</strong> cmdlet I rewrote the snippet to the following.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Get-ChildItem</span> HKLM:\Software\Classes <span style="color: pink;">|</span> <span style="color: pink;">?</span><span style="color: #000000;">&#123;</span> <span style="color: #000080;">$_</span>.PSChildName <span style="color: #FF0000;">-match</span> <span style="color: #800000;">'^\w+\.\w+$'</span> <span style="color: #FF0000;">-and</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-ItemProperty</span> <span style="color: #800000;">&quot;$($_.PSPath)\CLSID&quot;</span> <span style="color: pink;">-</span>ea <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Format-Table</span> <span style="color: #008080; font-style: italic;">-Property</span> PSChildName</pre></div></div>

<p>This nifty script displays all the available COM Objects that I can make use of with PowerShell, can tell this is going to be a long night...</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-29.png" rel="lightbox[232]"><img class="aligncenter size-medium wp-image-233" title="2010-08-29" src="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-29-208x300.png" alt="" width="208" height="300" /></a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;submitHeadline=Listing+all+COM+Objects+with+PowerShell&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;title=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;title=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;title=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;title=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;title=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;T=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;title=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;title=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Listing+all+COM+Objects+with+PowerShell+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D232&amp;t=Listing+all+COM+Objects+with+PowerShell" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=232</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates for 2010-08-29</title>
		<link>http://www.rn.co.za/html/?p=239</link>
		<comments>http://www.rn.co.za/html/?p=239#comments</comments>
		<pubDate>Sun, 29 Aug 2010 17:50:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=239</guid>
		<description><![CDATA[http://www.youtube.com/watch?v=exmwSxv7XJI&#38;feature=player_embedded # Grr I got 3 meetings back to back # yay - Anti-Aliasing support for StarCraft II # RT @DStv RT @MultiChoice: More ISP&#039;s sign up for DStv ON DEMAND http://is.gd/eExge # I need the weekend! # RT @sabreakingnews: SABC board&#039;s turnaround intervention http://bit.ly/d8Br5Q # Fianlly fixed the twitter feed in my blog, http://www.rn.co.za/ [...]]]></description>
			<content:encoded><![CDATA[<ul class="aktt_tweet_digest">
<li><a href="http://www.youtube.com/watch?v=exmwSxv7XJI&amp;feature=player_embedded" rel="nofollow">http://www.youtube.com/watch?v=exmwSxv7XJI&amp;feature=player_embedded</a> <a href="http://twitter.com/richardniemand/statuses/21907228061" class="aktt_tweet_time">#</a></li>
<li>Grr I got 3 meetings back to back <img src='http://www.rn.co.za/html/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  <a href="http://twitter.com/richardniemand/statuses/21981874072" class="aktt_tweet_time">#</a></li>
<li>yay - Anti-Aliasing support for StarCraft II <a href="http://twitter.com/richardniemand/statuses/22162818583" class="aktt_tweet_time">#</a></li>
<li>RT @<a href="http://twitter.com/DStv" class="aktt_username">DStv</a> RT @<a href="http://twitter.com/MultiChoice" class="aktt_username">MultiChoice</a>: More ISP&#039;s sign up for DStv ON DEMAND <a href="http://is.gd/eExge" rel="nofollow">http://is.gd/eExge</a> <a href="http://twitter.com/richardniemand/statuses/22163299166" class="aktt_tweet_time">#</a></li>
<li>I need the weekend! <a href="http://twitter.com/richardniemand/statuses/22261915409" class="aktt_tweet_time">#</a></li>
<li>RT @<a href="http://twitter.com/sabreakingnews" class="aktt_username">sabreakingnews</a>: SABC board&#039;s turnaround intervention <a href="http://bit.ly/d8Br5Q" rel="nofollow">http://bit.ly/d8Br5Q</a> <a href="http://twitter.com/richardniemand/statuses/22262242973" class="aktt_tweet_time">#</a></li>
<li>Fianlly fixed the twitter feed in my blog, <a href="http://www.rn.co.za/" rel="nofollow">http://www.rn.co.za/</a> <a href="http://twitter.com/richardniemand/statuses/22269201353" class="aktt_tweet_time">#</a></li>
<li>Geeking out with PowerShell <a href="http://twitter.com/richardniemand/statuses/22457731709" class="aktt_tweet_time">#</a></li>
</ul>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;submitHeadline=Twitter+Weekly+Updates+for+2010-08-29&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;title=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;title=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;title=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;title=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;title=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;T=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;title=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;title=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Twitter+Weekly+Updates+for+2010-08-29+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D239&amp;t=Twitter+Weekly+Updates+for+2010-08-29" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=239</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Updates for 2010-08-28</title>
		<link>http://www.rn.co.za/html/?p=231</link>
		<comments>http://www.rn.co.za/html/?p=231#comments</comments>
		<pubDate>Sat, 28 Aug 2010 05:50:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=231</guid>
		<description><![CDATA[I need the weekend! # RT @sabreakingnews: SABC board&#039;s turnaround intervention http://bit.ly/d8Br5Q # Fianlly fixed the twitter feed in my blog, http://www.rn.co.za/ # Bookmark It]]></description>
			<content:encoded><![CDATA[<ul class="aktt_tweet_digest">
<li>I need the weekend! <a href="http://twitter.com/richardniemand/statuses/22261915409" class="aktt_tweet_time">#</a></li>
<li>RT @<a href="http://twitter.com/sabreakingnews" class="aktt_username">sabreakingnews</a>: SABC board&#039;s turnaround intervention <a href="http://bit.ly/d8Br5Q" rel="nofollow">http://bit.ly/d8Br5Q</a> <a href="http://twitter.com/richardniemand/statuses/22262242973" class="aktt_tweet_time">#</a></li>
<li>Fianlly fixed the twitter feed in my blog, <a href="http://www.rn.co.za/" rel="nofollow">http://www.rn.co.za/</a> <a href="http://twitter.com/richardniemand/statuses/22269201353" class="aktt_tweet_time">#</a></li>
</ul>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;submitHeadline=Twitter+Updates+for+2010-08-28&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;title=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;title=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;title=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;title=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;title=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;T=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;title=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;title=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Twitter+Updates+for+2010-08-28+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D231&amp;t=Twitter+Updates+for+2010-08-28" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=231</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Start Process and Get its PID</title>
		<link>http://www.rn.co.za/html/?p=227</link>
		<comments>http://www.rn.co.za/html/?p=227#comments</comments>
		<pubDate>Fri, 27 Aug 2010 13:46:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[New-Process]]></category>
		<category><![CDATA[ProcessID]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=227</guid>
		<description><![CDATA[I needed to start a process on my machine and get its procesID in PowerShell to monitor that it does not run longer than x min. This sounded simple, but was a bit of a challenge with PowerShell (mostly that I could not get the Start-Process cmdlet to return this information). After playing on Google [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to start a process on my machine and get its procesID in PowerShell to monitor that it does not run longer than x min. This sounded simple, but was a bit of a challenge with PowerShell (mostly that I could not get the <strong>Start-Process</strong> cmdlet to return this information).</p>
<p>After playing on Google I stumbled upon the following links to MSDN and it hit me, PowerShell is based on .net, and there are tons of scripts on the net for starting processes with .net. With the following 3 links I was able to get something working.</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx">http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx"></a><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx">http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.processwindowstyle(VS.85).aspx">http://msdn.microsoft.com/en-us/library/system.diagnostics.processwindowstyle(VS.85).aspx</a></li>
</ul>
<p>After a bit of playing I was able to come up with the following script.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$ProcessStartInfo</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Diagnostics.ProcessStartInfo <span style="color: #800000;">&quot;notepad.exe&quot;</span>
<span style="color: #800080;">$Process</span>          <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.Diagnostics.Process<span style="color: #000000;">&#93;</span>::Start<span style="color: #000000;">&#40;</span><span style="color: #800080;">$ProcessStartInfo</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$Process</span>.Id</pre></div></div>

<p>Pretty nifty eh, but still not what I wanted. In my case I need to start the process hidden as I do not want users to interact with it, so now I need to figure out how to start the process hidden. From the 3<sup>rd</sup> link I know that I can set the process window style to <strong>Hidden</strong>, but how do I do this?</p>
<p>I start by piping the $ProcessStartInfo to the <strong>Get-Member</strong> cmdlet, and behold I now know the value of the WindowStyle property.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Name                    MemberType Definition
<span style="color: pink;">----</span>                    <span style="color: pink;">----------</span> <span style="color: pink;">----------</span>
Equals                  Method     bool Equals<span style="color: #000000;">&#40;</span>System.Object obj<span style="color: #000000;">&#41;</span>
GetHashCode             Method     int GetHashCode<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
GetType                 Method     <span style="color: #008080; font-weight: bold;">type</span> GetType<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
ToString                Method     string ToString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
Arguments               Property   System.String Arguments <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
CreateNoWindow          Property   System.Boolean CreateNoWindow <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
Domain                  Property   System.String Domain <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
EnvironmentVariables    Property   System.Collections.Specialized.StringDict...
ErrorDialog             Property   System.Boolean ErrorDialog <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
ErrorDialogParentHandle Property   System.IntPtr ErrorDialogParentHandle <span style="color: #000000;">&#123;</span>ge...
FileName                Property   System.String FileName <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
LoadUserProfile         Property   System.Boolean LoadUserProfile <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
Password                Property   System.Security.SecureString Password <span style="color: #000000;">&#123;</span>ge...
RedirectStandardError   Property   System.Boolean RedirectStandardError <span style="color: #000000;">&#123;</span>get...
RedirectStandardInput   Property   System.Boolean RedirectStandardInput <span style="color: #000000;">&#123;</span>get...
RedirectStandardOutput  Property   System.Boolean RedirectStandardOutput <span style="color: #000000;">&#123;</span>ge...
StandardErrorEncoding   Property   System.Text.Encoding StandardErrorEncodin...
StandardOutputEncoding  Property   System.Text.Encoding StandardOutputEncodi...
UserName                Property   System.String UserName <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
UseShellExecute         Property   System.Boolean UseShellExecute <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
Verb                    Property   System.String Verb <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span>
Verbs                   Property   System.String<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> Verbs <span style="color: #000000;">&#123;</span>get;<span style="color: #000000;">&#125;</span>
WindowStyle             Property   System.Diagnostics.ProcessWindowStyle Win...
WorkingDirectory        Property   System.String WorkingDirectory <span style="color: #000000;">&#123;</span>get;set;<span style="color: #000000;">&#125;</span></pre></div></div>

<p>So let’s set it.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$ProcessStartInfo</span>.WindowStyle <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Hidden&quot;</span></pre></div></div>

<p>I run this and no errors, this is promising.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-27-1.png" rel="lightbox[227]"><img class="aligncenter size-medium wp-image-228" title="2010-08-27-1" src="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-27-1-300x44.png" alt="" width="300" height="44" /></a></p>
<p>A quick check of task manager confirms that I have successfully started the process, and have the correct procesID.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-27-2.png" rel="lightbox[227]"><img class="aligncenter size-medium wp-image-229" title="2010-08-27-2" src="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-27-2-300x26.png" alt="" width="300" height="26" /></a></p>
<p>That’s all there is to it, albeit it took me a good hour to figure out L. Now I can continue with my script.</p>
<p>Here is the complete code listing to start a process and get its processID.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$ProcessStartInfo</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Diagnostics.ProcessStartInfo <span style="color: #800000;">&quot;notepad.exe&quot;</span>
<span style="color: #800080;">$ProcessStartInfo</span>.WindowStyle <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Hidden&quot;</span>
<span style="color: #800080;">$Process</span>          <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.Diagnostics.Process<span style="color: #000000;">&#93;</span>::Start<span style="color: #000000;">&#40;</span><span style="color: #800080;">$ProcessStartInfo</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$Process</span>.Id</pre></div></div>

<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;submitHeadline=PowerShell+Start+Process+and+Get+its+PID&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;title=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;title=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;title=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;title=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;title=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;T=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;title=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;title=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+PowerShell+Start+Process+and+Get+its+PID+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D227&amp;t=PowerShell+Start+Process+and+Get+its+PID" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=227</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCOM &#8211; Creating alerts based on Event Description</title>
		<link>http://www.rn.co.za/html/?p=219</link>
		<comments>http://www.rn.co.za/html/?p=219#comments</comments>
		<pubDate>Tue, 17 Aug 2010 14:57:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SCOM \ OpsMgr]]></category>
		<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[Operations Manager]]></category>
		<category><![CDATA[SCOM]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=219</guid>
		<description><![CDATA[It’s been a while since my last post, so I thought that I would try and make this one count. I am trying my best to play around with SCOM as much as possible, but am finding it hard to find the time to do so. For this post I am going to be filtering [...]]]></description>
			<content:encoded><![CDATA[<p>It’s been a while since my last post, so I thought that I would try and make this one count. I am trying my best to play around with SCOM as much as possible, but am finding it hard to find the time to do so.</p>
<p>For this post I am going to be filtering alerts in SCOM by the <strong>Event Description</strong>, this is not best practice as this will add additional overhead to the SCOM agent, but in some cases this is the best solution to the problem.</p>
<p>The first thing that I am going to need to do is create an alert in SCOM that we can use to filter on. Lets do that.</p>
<ul>
<li>Open the authoring console and create a blank MP
<ul>
<li>I am calling mine <strong>Richard.Alert.Test</strong></li>
</ul>
</li>
<li>Create a new <strong>Windows Event Alerting</strong> rule and give it a name
<ul>
<li>Mine will be called <strong>Richard.Alert.Test.FilterTestAlert</strong></li>
<li><strong> </strong>Target this rule at <strong>Windows.Server.Computer</strong></li>
<li><strong></strong>For the category, select Alert (to keep things uniform).</li>
<li>Click Next</li>
</ul>
</li>
<li>For the <strong>Event Log Name</strong> page complete the following:
<ul>
<li>For the Log Name, select “Operations Manager”</li>
<li>Click Next</li>
</ul>
</li>
<li>For the <strong>Build Event Expression</strong> page complete the following:
<ul>
<li>EventID = 12345</li>
<li>Click Insert, Select “Use parameter name not specified above” and for the value enter in “EventDescription”, click OK to close the dialog</li>
<li>For the <strong>Operator</strong> select “Contains”</li>
<li>For the value, enter in “Hello World”</li>
<li>Click Next to continue</li>
</ul>
</li>
<li>On the <strong>Configur Alerts</strong> page complete the following:
<ul>
<li>Enter in an Alert Name</li>
<li>For the event description, leave this as is (for now – you can change this later)</li>
<li>If needs be, change the Priority, Severity and Suppression for the alert</li>
<li>Click Finish to complete the creation of the alert.</li>
</ul>
</li>
</ul>
<p>For testing purposes you should disable this rule explicitly and target it at your test server (I am not going to be doing this).</p>
<p>The next stage of this would be to import the MP into SCOM and test this guy out. The first thing I am going to do is create a test alert on my server that will not satisfy the alerting rule.</p>
<p>Using the following VBScript I generate the below alert on my serve, check SCOM to see that nothing comes through.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Set</span> oAPI			= CreateObject(<span style="color: #800000;">&quot;MOM.ScriptAPI&quot;</span>)
eventDescription	= <span style="color: #800000;">&quot;This will not alert in SCOM&quot;</span>
scriptName			= <span style="color: #800000;">&quot;TestAlert.vbs&quot;</span>
eventID				= 12345
<span style="color: #000080;">Call</span> oAPI.LogScriptEvent(scriptName, eventID, 1, eventDescription)</pre></div></div>

<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17-1.png" rel="lightbox[219]"><img class="aligncenter size-medium wp-image-220" title="2010-08-17 - 1" src="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17-1-300x18.png" alt="" width="300" height="18" /></a></p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17-2.png" rel="lightbox[219]"><img class="aligncenter size-medium wp-image-221" title="2010-08-17 - 2" src="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17-2-300x62.png" alt="" width="300" height="62" /></a></p>
<p>Now that I see filtering is working, the next step is to add the text “Hello World” to the alert and see if anything comes into SCOM. To do this I modify my alert VBScript to look something like the below and run this on my server.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Set</span> oAPI			= CreateObject(<span style="color: #800000;">&quot;MOM.ScriptAPI&quot;</span>)
eventDescription	= <span style="color: #800000;">&quot;Hello World, I should appear in SCOM&quot;</span>
scriptName			= <span style="color: #800000;">&quot;TestAlert.vbs&quot;</span>
eventID				= 12345
<span style="color: #000080;">Call</span> oAPI.LogScriptEvent(scriptName, eventID, 1, eventDescription)</pre></div></div>

<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17-3.png" rel="lightbox[219]"><img class="aligncenter size-medium wp-image-222" title="2010-08-17 - 3" src="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17-3-300x18.png" alt="" width="300" height="18" /></a></p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17-4.png" rel="lightbox[219]"><img class="aligncenter size-medium wp-image-223" title="2010-08-17 - 4" src="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17-4-300x96.png" alt="" width="300" height="96" /></a></p>
<p>The rule is working <img src='http://www.rn.co.za/html/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You could take this a step further and allow the rule to filter on Regular expressions, not contains etc if you need to.</p>
<p>You can grab the completed <a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17.zip">Management Pack</a> from <a href="http://www.rn.co.za/html/wp-content/uploads/2010/08/2010-08-17.zip">here</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;submitHeadline=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;title=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;title=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;title=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;title=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;title=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;T=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;title=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;title=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D219&amp;t=SCOM+%26%238211%3B+Creating+alerts+based+on+Event+Description" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=219</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scoping in JS</title>
		<link>http://www.rn.co.za/html/?p=217</link>
		<comments>http://www.rn.co.za/html/?p=217#comments</comments>
		<pubDate>Wed, 07 Jul 2010 10:32:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scoping]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=217</guid>
		<description><![CDATA[I have recently been working on a web based time keeping system for our department to use which heavily relies on the wonders of mootools. It has been a while since I last played around with any JavaScript and it took me a bit of time to get my head back around it. Something that [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently been working on a web based time keeping system for our department to use which heavily relies on the wonders of mootools. It has been a while since I last played around with any JavaScript and it took me a bit of time to get my head back around it. Something that I found to be quiet useful albeit a bit frustrating was the scoping of JavaScript.</p>
<p>What I wanted to do was create a <strong>onDomReady</strong> event and attach a timer to the page (to refresh it). I kept getting stuck however when trying to access the timer object outside the constructor method, i.e. through another function. I spent a bit of time playing around and it finally hit me that a JS file is handled like a class (well that’s how JavaScript works as a whole), and that by declaring a <strong>var</strong> outside of all my methods would make that variable accessible to any other function. See the snippet below to illustrate my point.</p>
<p>Incorrect:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> myTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">var</span> timer <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> timer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
timer.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> externalAccess<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//Would never work, there is no scope to timer</span>
	timer.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Correct:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> timer<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> myTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
timer <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> timer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
timer.<span style="color: #660066;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> externalAccess<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//Scoped</span>
	timer.<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This little hint might save you some time, I know I won’t forget this ever again!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;submitHeadline=Scoping+in+JS&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;title=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;title=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;title=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;title=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;title=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;T=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;title=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;title=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Scoping+in+JS+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D217&amp;t=Scoping+in+JS" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=217</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Create Registry Key</title>
		<link>http://www.rn.co.za/html/?p=215</link>
		<comments>http://www.rn.co.za/html/?p=215#comments</comments>
		<pubDate>Sun, 27 Jun 2010 14:59:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Registry]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=215</guid>
		<description><![CDATA[Here is some code to create a registry key. I added the ability to first check if the key exists before attempting to create it, which is done in a foreach loop. This is simple and creates a new key under the HKCU registry hive. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Win32; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is some code to create a registry key. I added the ability to first check if the key exists before attempting to create it, which is done in a <strong>foreach</strong> loop. This is simple and creates a new key under the HKCU registry hive.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">Microsoft.Win32</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">namespace</span> regEnum
<span style="color: #000000;">&#123;</span>
    <span style="color: #FF0000;">class</span> Program
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            RegistryKey HKCU <span style="color: #008000;">=</span> Registry.<span style="color: #0000FF;">CurrentUser</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">bool</span> foundKey <span style="color: #008000;">=</span> false<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> subKeys <span style="color: #008000;">=</span> HKCU.<span style="color: #0000FF;">GetSubKeyNames</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> currentKey <span style="color: #0600FF;">in</span> subKeys<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>currentKey <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;Richard Test&quot;</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    foundKey <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>foundKey <span style="color: #008000;">==</span> <span style="color: #0600FF;">false</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                HKCU.<span style="color: #0000FF;">CreateSubKey</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Richard Test&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Created Registry Key: HKCU<span style="color: #008080; font-weight: bold;">\\</span>Richard Test&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">else</span>
            <span style="color: #000000;">&#123;</span>
                Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Key: HKCU<span style="color: #008080; font-weight: bold;">\\</span>Richard Test already exists&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;submitHeadline=C%23+Create+Registry+Key&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;title=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;title=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;title=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;title=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;title=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;T=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;title=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;title=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C%23+Create+Registry+Key+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D215&amp;t=C%23+Create+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=215</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Recursively Enumerate Registry Sub keys</title>
		<link>http://www.rn.co.za/html/?p=213</link>
		<comments>http://www.rn.co.za/html/?p=213#comments</comments>
		<pubDate>Sun, 27 Jun 2010 14:50:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Registry]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=213</guid>
		<description><![CDATA[I managed to recursively loop though all the Keys and sub keys for a registry path, with a little bit more effort than I wanted to. Ideally I wanted to create all of this in one class, but seeing that the class I wanted to make use of was the entry point into the program, [...]]]></description>
			<content:encoded><![CDATA[<p>I managed to recursively loop though all the Keys and sub keys for a registry path, with a little bit more effort than I wanted to. Ideally I wanted to create all of this in one class, but seeing that the class I wanted to make use of was the entry point into the program, I could not seem to get this correct. Finally the work around for this was to create a new class <strong>keyWalker</strong> which I then created an instance of, called the <strong>enumerateKeysRecurse()</strong> method which then calls itself for each sub key it finds.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">Microsoft.Win32</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">namespace</span> regEnum
<span style="color: #000000;">&#123;</span>
    <span style="color: #FF0000;">class</span> Program
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">string</span> regPath <span style="color: #008000;">=</span> <span style="color: #666666;">@&quot;Control Panel&quot;</span><span style="color: #008000;">;</span>
            keyWalker walker <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> keyWalker<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            walker.<span style="color: #0000FF;">enumerateKeysRecurse</span><span style="color: #000000;">&#40;</span>regPath<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #FF0000;">class</span> keyWalker
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> enumerateKeysRecurse<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> keyPath<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            RegistryKey HKLM <span style="color: #008000;">=</span> Registry.<span style="color: #0000FF;">CurrentUser</span><span style="color: #008000;">;</span>
            RegistryKey RegKey <span style="color: #008000;">=</span> HKLM.<span style="color: #0000FF;">OpenSubKey</span><span style="color: #000000;">&#40;</span>keyPath<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> subKeys <span style="color: #008000;">=</span> RegKey.<span style="color: #0000FF;">GetSubKeyNames</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> subKey <span style="color: #0600FF;">in</span> subKeys<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">string</span> fullPath <span style="color: #008000;">=</span> keyPath <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\\</span>&quot;</span> <span style="color: #008000;">+</span> subKey<span style="color: #008000;">;</span>
                <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">enumerateKeysRecurse</span><span style="color: #000000;">&#40;</span>fullPath<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>fullPath<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;submitHeadline=C%23+Recursively+Enumerate+Registry+Sub+keys&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;title=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;title=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;title=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;title=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;title=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;T=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;title=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;title=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C%23+Recursively+Enumerate+Registry+Sub+keys+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D213&amp;t=C%23+Recursively+Enumerate+Registry+Sub+keys" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=213</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Get Registry Key Values</title>
		<link>http://www.rn.co.za/html/?p=211</link>
		<comments>http://www.rn.co.za/html/?p=211#comments</comments>
		<pubDate>Sun, 27 Jun 2010 14:36:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Registry]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=211</guid>
		<description><![CDATA[Here is a snippet of code that enumerates all the values within a Registry Key. For each value found under the key I am fetching the type of the value, the name of the value and the physical value. When making use of the ToString() method a lot here to allow for me to print [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a snippet of code that enumerates all the values within a Registry Key. For each value found under the key I am fetching the type of the value, the name of the value and the physical value. When making use of the <strong>ToString</strong>() method a lot here to allow for me to print certain values to the Console. Some important things to take note of here is the following.</p>
<p>I make use of the <strong>@</strong> modifier to allow me to use un-escaped strings for the key path (see regPath).</p>
<p>The <strong>ToString</strong>() method is used to ensure that all values are converted to strings that are able to be written out to the console.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">Microsoft.Win32</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">namespace</span> regEnum
<span style="color: #000000;">&#123;</span>
    <span style="color: #FF0000;">class</span> Program
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">string</span> regPath <span style="color: #008000;">=</span> <span style="color: #666666;">@&quot;Control Panel\Desktop&quot;</span><span style="color: #008000;">;</span>
            RegistryKey HKLM <span style="color: #008000;">=</span> Registry.<span style="color: #0000FF;">CurrentUser</span><span style="color: #008000;">;</span>
            RegistryKey RegKey <span style="color: #008000;">=</span> HKLM.<span style="color: #0000FF;">OpenSubKey</span><span style="color: #000000;">&#40;</span>regPath<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> subVals <span style="color: #008000;">=</span> RegKey.<span style="color: #0000FF;">GetValueNames</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;------------------------------------------&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Enumerating: HKCU<span style="color: #008080; font-weight: bold;">\\</span>{0}&quot;</span>, regPath<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;------------------------------------------&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> val <span style="color: #0600FF;">in</span> subVals<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">string</span> keyName <span style="color: #008000;">=</span> val<span style="color: #008000;">;</span>
                <span style="color: #FF0000;">string</span> keyType <span style="color: #008000;">=</span> RegKey.<span style="color: #0000FF;">GetValueKind</span><span style="color: #000000;">&#40;</span>val<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #FF0000;">string</span> keyValue <span style="color: #008000;">=</span> RegKey.<span style="color: #0000FF;">GetValue</span><span style="color: #000000;">&#40;</span>val<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;[{0}] {1} : {2}&quot;</span>, keyType, keyName, keyValue<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;submitHeadline=C%23+Get+Registry+Key+Values&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;title=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;title=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;title=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;title=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;title=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;T=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;title=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;title=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C%23+Get+Registry+Key+Values+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D211&amp;t=C%23+Get+Registry+Key+Values" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=211</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Enumerate registry keys</title>
		<link>http://www.rn.co.za/html/?p=209</link>
		<comments>http://www.rn.co.za/html/?p=209#comments</comments>
		<pubDate>Sun, 27 Jun 2010 12:33:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Registry]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=209</guid>
		<description><![CDATA[I am in the process of teaching myself how to code using C# and have decided that the first place I would like to start is with the registry. This snippet of code below shows how to enumerate the sub keys of a registry path. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Win32; [...]]]></description>
			<content:encoded><![CDATA[<p>I am in the process of teaching myself how to code using C# and have decided that the first place I would like to start is with the registry. This snippet of code below shows how to enumerate the sub keys of a registry path.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">Microsoft.Win32</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF;">namespace</span> regEnum
<span style="color: #000000;">&#123;</span>
    <span style="color: #FF0000;">class</span> Program
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            RegistryKey HKLM <span style="color: #008000;">=</span> Registry.<span style="color: #0000FF;">LocalMachine</span><span style="color: #008000;">;</span>
            RegistryKey RegKey <span style="color: #008000;">=</span> HKLM.<span style="color: #0000FF;">OpenSubKey</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;SOFTWARE<span style="color: #008080; font-weight: bold;">\\</span>Microsoft&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> subKeys <span style="color: #008000;">=</span> RegKey.<span style="color: #0000FF;">GetSubKeyNames</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">int</span> subKeyCount <span style="color: #008000;">=</span> subKeys.<span style="color: #0000FF;">Length</span><span style="color: #008000;">;</span>
&nbsp;
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;There are {0} Keys in <span style="color: #008080; font-weight: bold;">\&quot;</span>{1}<span style="color: #008080; font-weight: bold;">\&quot;</span>&quot;</span>, subKeyCount, RegKey.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> curKey <span style="color: #0600FF;">in</span> subKeys<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>curKey<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>In order to make use of the registry functions built into .net you need to include the <strong>Microsoft.Win32</strong> class. The following logic was used to enumerate the registry keys:</p>
<ol>
<li>Create a var called <strong>HKLM</strong> of type RegistryKey</li>
<li>Open the current key you want to enumerate</li>
<li>Get all the sub keys by calling the <strong>GetSubKeyNames</strong>() method.</li>
<li>Loop through the keys using foreach, printing out all the values to the console</li>
</ol>
<p>That’s about all there seems to be in enumerating sub keys in the registry.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;submitHeadline=C%23+Enumerate+registry+keys&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;title=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;title=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;title=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;title=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;title=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;T=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;title=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;title=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C%23+Enumerate+registry+keys+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D209&amp;t=C%23+Enumerate+registry+keys" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=209</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Read a Registry Key</title>
		<link>http://www.rn.co.za/html/?p=207</link>
		<comments>http://www.rn.co.za/html/?p=207#comments</comments>
		<pubDate>Sun, 27 Jun 2010 12:19:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Registry]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=207</guid>
		<description><![CDATA[This is the simplest way I have found to read a registry key in C#, this might not be the best way, but it does what I need it to do RegistryKey HKLM = Registry.LocalMachine; RegistryKey RegKey = HKLM.OpenSubKey&#40;&#34;SOFTWARE\\Oracle\\VirtualBox&#34;&#41;; MessageBox.Show&#40;RegKey.GetValue&#40;&#34;InstallDir&#34;&#41;.ToString&#40;&#41;&#41;; To make use of the RegistryKey class you will need to include the Microsoft.Win32 class. [...]]]></description>
			<content:encoded><![CDATA[<p>This is the simplest way I have found to read a registry key in C#, this might not be the best way, but it does what I need it to do <img src='http://www.rn.co.za/html/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">RegistryKey HKLM <span style="color: #008000;">=</span> Registry.<span style="color: #0000FF;">LocalMachine</span><span style="color: #008000;">;</span>
RegistryKey RegKey <span style="color: #008000;">=</span> HKLM.<span style="color: #0000FF;">OpenSubKey</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;SOFTWARE<span style="color: #008080; font-weight: bold;">\\</span>Oracle<span style="color: #008080; font-weight: bold;">\\</span>VirtualBox&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span>RegKey.<span style="color: #0000FF;">GetValue</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;InstallDir&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>To make use of the RegistryKey class you will need to include the <strong>Microsoft.Win32</strong> class.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;submitHeadline=C%23+Read+a+Registry+Key&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;title=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;title=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;title=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;title=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;title=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;T=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;title=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;title=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C%23+Read+a+Registry+Key+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D207&amp;t=C%23+Read+a+Registry+Key" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=207</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Telkom 4 Mb</title>
		<link>http://www.rn.co.za/html/?p=204</link>
		<comments>http://www.rn.co.za/html/?p=204#comments</comments>
		<pubDate>Sun, 27 Jun 2010 11:23:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=204</guid>
		<description><![CDATA[Just thought I would share this with the rest of the world, this is the actual throughput of a Telkom 4Mb ADSL line in deepest darkest Africa. Sometimes I think that we are getting messed around a lot by them... Bookmark It]]></description>
			<content:encoded><![CDATA[<p>Just thought I would share this with the rest of the world, this is the actual throughput of a Telkom 4Mb ADSL line in deepest darkest Africa.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/speed-test.png" rel="lightbox[204]"><img class="aligncenter size-full wp-image-205" title="speed test" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/speed-test.png" alt="" width="299" height="172" /></a></p>
<p>Sometimes I think that we are getting messed around a lot by them...</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;submitHeadline=Telkom+4+Mb&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;title=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;title=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;title=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;title=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;title=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;T=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;title=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;title=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Telkom+4+Mb+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D204&amp;t=Telkom+4+Mb" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=204</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server 2008 New SID</title>
		<link>http://www.rn.co.za/html/?p=202</link>
		<comments>http://www.rn.co.za/html/?p=202#comments</comments>
		<pubDate>Sun, 27 Jun 2010 09:53:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Server 2008]]></category>
		<category><![CDATA[SID]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=202</guid>
		<description><![CDATA[I am in the process of studying for my 70-640 exam and have run into issues with my cloned servers and their SIDs. I did some googling and found out that there is a way to change the SID of a server 2008 machine using the NewSID (although some people say that it should not [...]]]></description>
			<content:encoded><![CDATA[<p>I am in the process of studying for my 70-640 exam and have run into issues with my cloned servers and their SIDs. I did some googling and found out that there is a way to change the SID of a server 2008 machine using the NewSID (although some people say that it should not work).</p>
<p>On the M$ site there is no link to download the NewSID (they have removed it) so it can be found over here. <a href="http://www.softpedia.com/get/System/System-Miscellaneous/NewSID.shtml">http://www.softpedia.com/get/System/System-Miscellaneous/NewSID.shtml</a></p>
<p>I have tested this on a Server 2008 Full VM and it works perfectly.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;submitHeadline=Server+2008+New+SID&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;title=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;title=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;title=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;title=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;title=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;T=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;title=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;title=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Server+2008+New+SID+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D202&amp;t=Server+2008+New+SID" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=202</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C-MP 4B : Collecting Memory Usage – WMI</title>
		<link>http://www.rn.co.za/html/?p=190</link>
		<comments>http://www.rn.co.za/html/?p=190#comments</comments>
		<pubDate>Fri, 18 Jun 2010 10:37:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=190</guid>
		<description><![CDATA[My last post detailed how to use our custom class to collect performance data for our Richard.CustomMP.Spooler class using the Windows Performance Collection template and ultimately Perfmon on the target box. The Performance Collection template is useful for collecting standard performance data, but what if you want to collect something non-standard like the number of [...]]]></description>
			<content:encoded><![CDATA[<p>My <strong><a href="http://www.rn.co.za/html/?p=178">last post</a></strong> detailed how to use our custom class to collect performance data for our <strong>Richard.CustomMP.Spooler</strong> class using the Windows Performance Collection template and ultimately Perfmon on the target box. The Performance Collection template is useful for collecting standard performance data, but what if you want to collect something non-standard like the number of files in a folder?</p>
<p>The solution would be to create a custom performance collection script. The concept is basically the same for a custom script and a performance collection rule, the only catch here is that you will need to be able to create the script to do the collection. I would recommend using google to get you started with the scripting if you are not 100% sure where to start.</p>
<p>For the example used in this management pack I will be collecting the CPU usage of the spooler service. I will be using VBScript as this is the simplest way of collecting the information (until PowerShell is supported with wizards in the authoring console). As per normal the <strong><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18.txt">script is attached</a> (rename to .vbs)</strong> to this post if you would like to have a look through it, or you can view it directly in the management pack.</p>
<p><strong>Adding our collection script to the Management Pack</strong></p>
<p>The first thing we will need to do is open up the Authoring Console, open our management pack and navigate over to <strong>Health Model</strong> -&gt; <strong>Rules</strong>. Right click in the Rules pane and select <strong>New</strong> -&gt; <strong>Collection</strong> -&gt; <strong>Performance Based</strong> -&gt; <strong>Script Based Performance Collection</strong>, this will launch the required wizard.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-1.png" rel="lightbox[190]"><img class="aligncenter size-medium wp-image-192" title="2010-06-18-1" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-1-300x72.png" alt="" width="300" height="72" /></a></p>
<p>Complete the first page as follows:</p>
<p><strong>ElementID:</strong> Richard.CustomMP.Spooler.CPUUsage.Perf.13002<br />
<strong>Display Name:</strong> Richard.CustomMP: Spooler - CPU Usage (Perf) (13002)<br />
<strong>Description:</strong> Collects the CPU usage of the spooler service vai VBScript.<br />
<strong>Target:</strong> Richard.CustomMP.Spooler<br />
<strong>Category:</strong> PerformanceCollection</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-2.png" rel="lightbox[190]"><img class="aligncenter size-medium wp-image-193" title="2010-06-18-2" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-2-300x266.png" alt="" width="300" height="266" /></a>Click <strong>Next</strong> to continue to the schedule. For the schedule I am going to run this collection every 5 min.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-3.png" rel="lightbox[190]"><img class="aligncenter size-full wp-image-194" title="2010-06-18-3" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-3.png" alt="" width="209" height="142" /></a></p>
<p>Click <strong>next</strong> to continue over to the script screen. Complete the following information and click the <strong>Parameters</strong> button when complete:</p>
<p><strong>File Name:</strong> Richard.CustomMP.Spooler.CPUUsage.Perf.13002.vbs<br />
<strong>Timeout: </strong>1 Min<br />
<strong>Script:</strong> Paste your script here</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-4.png" rel="lightbox[190]"><img class="aligncenter size-medium wp-image-195" title="2010-06-18-4" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-4-300x252.png" alt="" width="300" height="252" /></a></p>
<p>On the parameters screen, from the fly-out select the <strong>Name</strong> of the service, click <strong>OK</strong> when done.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-5.png" rel="lightbox[190]"><img class="aligncenter size-medium wp-image-196" title="2010-06-18-5" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-5-300x139.png" alt="" width="300" height="139" /></a></p>
<p>Click <strong>Next</strong> to continue to the Performance Mapper Screen.</p>
<p>Our script works by connecting to WMI and querying for the relevant information regarding our service (in this case the CPU Usage), and submitting that information back to SCOM in the form of a property bag. The performance mapper section of the wizard allows us to tell SCOM which bits of the information returned needs to be collected as performance data. As you may have noticed (if you tested the script first) is that the data returned is in the form of XML which is an easy format to query. SCOM stores all the information back from the script in the <strong>$data/…$</strong> variable, and to get the values we need to map we make use of Xpath queries against the returned XML. So basically <strong>$Data/Property[@Name='bob']$</strong> is referring to an element name in the returned XML called bob.</p>
<p>Armed with my quick description of how information is given back from SCOM, lets complete the Performance Mapper page, the following information will need to be entered in:</p>
<p><strong>Object:</strong> Spooler CPU<br />
<strong>Counter:</strong> % CPU<br />
<strong>Instance:</strong> Total<br />
<strong>Value:</strong> $Data/Property[@Name='PercentProcessorTime']$</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-6.png" rel="lightbox[190]"><img class="aligncenter size-medium wp-image-197" title="2010-06-18-6" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-6-300x140.png" alt="" width="300" height="140" /></a></p>
<p>After importing the updated management pack and waiting 15 min I finally see the following information coming into SCOM, the only problem is that the spooler service is nothing special to look at <img src='http://www.rn.co.za/html/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-7.png" rel="lightbox[190]"><img class="aligncenter size-medium wp-image-198" title="2010-06-18-7" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18-7-300x74.png" alt="" width="300" height="74" /></a>Click here to <a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-18.zip">grab the latest build</a> of the management pack.</p>
<p style="text-align: right;">[<a href="http://www.rn.co.za/html/?p=100">Back to MP Index</a>]</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;submitHeadline=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;title=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;title=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;title=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;title=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;title=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;T=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;title=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;title=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D190&amp;t=C-MP+4B+%3A+Collecting+Memory+Usage+%E2%80%93+WMI" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=190</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C-MP 4A : Collecting CPU Information &#8211; Perfmon</title>
		<link>http://www.rn.co.za/html/?p=178</link>
		<comments>http://www.rn.co.za/html/?p=178#comments</comments>
		<pubDate>Thu, 17 Jun 2010 10:24:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SCOM \ OpsMgr]]></category>
		<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[Operations Manager]]></category>
		<category><![CDATA[SCOM]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=178</guid>
		<description><![CDATA[Now that we have discovered our Spooler class, it’s about time that we start to collect some useful information about all the instances. The first thing that I would like to collect in the amount of CPU time the service is currently using. This information can be retrieved one of two ways: Performance Monitor (Perfmon) [...]]]></description>
			<content:encoded><![CDATA[<p>Now that we have discovered our <strong>Spooler</strong> class, it’s about time that we start to collect some useful information about all the instances. The first thing that I would like to collect in the amount of CPU time the service is currently using. This information can be retrieved one of two ways:</p>
<ol>
<li>Performance Monitor (Perfmon)</li>
<li>Windows Management Instrumentation (WMI)</li>
</ol>
<p>For now I am going to collect this using Perfmon (tomorrow I will use WMI). So the first thing we will need to do is fire up perfmon and have a look around for the counter that meets our needs. I know that the <strong>Process</strong> counter will contain information about the CPU usage of a process and after looking through the available instances I found that the <strong>spooldv</strong> represents our <strong>Spooler</strong> instance on my computer (this is the exe name of the service executable minus the exe portion). This is not a general rule of thumb for looking up processes in the <strong>Process</strong> counter, but for the <strong>Spooler Service</strong> it holds true.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-1.png" rel="lightbox[178]"><img class="aligncenter size-medium wp-image-179" title="2010-06-17-1" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-1-300x52.png" alt="" width="300" height="52" /></a></p>
<p>Now that we know the <strong>counter name</strong> and <strong>instance name</strong> we can open up our authoring console and edit our management pack. Navigate to <strong>Health Model</strong> -&gt; <strong>Rules</strong> and right click anywhere, select <strong>New</strong> -&gt; <strong>Collection</strong> -&gt; <strong>Performance Based</strong> -&gt; <strong>Windows Performance Collection</strong>.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-2.png" rel="lightbox[178]"><img class="aligncenter size-medium wp-image-180" title="2010-06-17-2" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-2-300x72.png" alt="" width="300" height="72" /></a></p>
<p>Complete the <strong>General</strong> screen with the following information:</p>
<p>Rule ID: Richard.CustomMP.Spooler.CPUUsage.Perf.13001<br />
Rule Name: Richard.CustomMP: Spooler CPU Usage (Perf) (13001)<br />
Description: Collects the CPU usage of the spooler service<br />
Target: Richard.CustomMP.Spooler<br />
Category: Performance Collection</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-3.png" rel="lightbox[178]"><img class="aligncenter size-medium wp-image-181" title="2010-06-17-3" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-3-300x138.png" alt="" width="300" height="138" /></a></p>
<p>Click <strong>Next</strong> to continue. On the <strong>Performance Counter</strong> screen, click the <a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-4.png" rel="lightbox[178]"><img class="alignnone size-full wp-image-183" title="2010-06-17-4" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-4.png" alt="" width="81" height="31" /></a> <strong></strong> button and select the spooler service counter from the dialog box that appears.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-5.png" rel="lightbox[178]"><img class="aligncenter size-medium wp-image-182" title="2010-06-17-5" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-5-300x239.png" alt="" width="300" height="239" /></a></p>
<p>For the interval, select 5 min.</p>
<p style="text-align: center;"><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-6.png" rel="lightbox[178]"><img class="size-full wp-image-184 aligncenter" title="2010-06-17-6" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-6.png" alt="" width="199" height="67" /></a></p>
<p>Click <strong>Next</strong> and <strong>Finish</strong> to complete creating your collection rule. As you can see from this example the performance collection was a piece of cake and after 10 min you can start seeing the data brought back into SCOM. A final thing I would like to point out is the “fly outs” that are available when populating the object and instance. SCOM allows you to push properties from your class or the parent of your class (and so on) to these values allowing for a totally dynamic monitoring solution. These could be useful if you needed to watch multiple counters on the same computer.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-7.png" rel="lightbox[178]"><img class="aligncenter size-full wp-image-185" title="2010-06-17-7" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-7.png" alt="" width="245" height="285" /></a></p>
<p>Unfortunately SCOM does not show 0 100% correctly, but as you can clearly see our collection is working and is collecting against our <strong>Richard.CustomMP.Spooler</strong> class.</p>
<p style="text-align: right;"><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-8.png" rel="lightbox[178]"><img class="aligncenter size-medium wp-image-186" title="2010-06-17-8" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17-8-300x116.png" alt="" width="300" height="116" /></a></p>
<p style="text-align: left;">You can grab the <a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-17.zip">latest build of the custom management pack</a> here,</p>
<p style="text-align: right;">[<a href="http://www.rn.co.za/html/?p=100">Back to MP Index</a>]</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;submitHeadline=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;title=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;title=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;title=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;title=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;title=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;T=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;title=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;title=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D178&amp;t=C-MP+4A+%3A+Collecting+CPU+Information+%26%238211%3B+Perfmon" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=178</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C-MP-3A : Creating a Health Monitor</title>
		<link>http://www.rn.co.za/html/?p=156</link>
		<comments>http://www.rn.co.za/html/?p=156#comments</comments>
		<pubDate>Mon, 14 Jun 2010 07:05:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SCOM \ OpsMgr]]></category>
		<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[MP Development]]></category>
		<category><![CDATA[Operations Manager]]></category>
		<category><![CDATA[SCOM]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=156</guid>
		<description><![CDATA[If you remember that from my last post (Testing our custom discovery) it worked and found some instances of the Print Spooler service. The only problem was that all the discovered instances were in a Not Monitored state. The reason for this is that there is no monitor to tell SCOM that the Print Spooler [...]]]></description>
			<content:encoded><![CDATA[<p>If you remember that from <a href="http://www.rn.co.za/html/?p=148">my last post</a> (Testing our custom discovery) it worked and found some instances of the <strong>Print Spooler</strong> service. The only problem was that all the discovered instances were in a <strong>Not Monitored</strong> state. The reason for this is that there is no monitor to tell SCOM that the <strong>Print Spooler</strong> is healthy.</p>
<p>The health state of an object in SCOM is set with a monitor. As you know there are a wide variety of monitors available in SCOM. I am going to be making use of a script based monitor targeted at our <strong>Richard.CustomMP.Spooler</strong> class. Depending on what our script returns we will set the health of the class to <strong>Healthy</strong> or <strong>Warning</strong>. The script I am going to be making use of is fairly simple (<strong><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14.txt">get it here</a></strong>) and checks the state of the service using WMI. It returns the state and StartMode of the service as a property bag (<a href="http://msdn.microsoft.com/en-us/library/bb437556.aspx">http://msdn.microsoft.com/en-us/library/bb437556.aspx</a>) which is something that SCOM can work with.</p>
<p>You can test the script by calling up a <strong>cmd</strong> window and calling “<em>cscript SCRIPT_NAME SERVICE_NAME<strong>”</strong></em>. If the service was found you will get a property bag with the state and StartMode of the service, otherwise a blank property bag will be returned.</p>
<p>To add the health monitor script onto your Management Pack, follow the steps taken by me below.</p>
<p>Open up the Authoring Console and navigate to <strong>Health Model</strong> -&gt; <strong>Monitors</strong>. Right click in the monitor’s pane and select <strong>New</strong> -&gt; <strong>Scripting</strong> -&gt; <strong>Two State</strong>. We are going to use a 2 state monitor as we will be setting the state of the class to <strong>healthy</strong> (service is running) or <strong>warning</strong> (service is stopped).</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-1.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-158" title="2010-06-14-1" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-1-300x205.png" alt="" width="300" height="205" /></a></p>
<p>Complete the first screen that appears with the following information:</p>
<ol>
<li><strong>Element ID:</strong> Richard.CustomMP.Spooler.HealthMonitor.13000</li>
<li><strong>Display Name:</strong> Richard.CustomMP: Spooler - Health Monitor (13000)</li>
<li><strong>Description:</strong> Checks the state of the print service.</li>
<li><strong>Target:</strong> Richard.CustomMP.Spooler</li>
<li><strong>Parent Monitor:</strong> System.Health.AvalabilityState</li>
<li><strong>Category:</strong> Avalability Health</li>
</ol>
<p>The screen should look like this:</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-2.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-159" title="2010-06-14-2" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-2-300x268.png" alt="" width="300" height="268" /></a></p>
<p>Click <strong>Next</strong> to continue. If you had read the script you would know that the interval that we want to run this is every 5 min, so set the <strong>Schedule</strong> for your script to that.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-3.png" rel="lightbox[156]"><img class="aligncenter size-full wp-image-160" title="2010-06-14-3" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-3.png" alt="" width="192" height="135" /></a>Click <strong>Next</strong> to go to the <strong>Script</strong> screen. Complete this screen by giving the script a name (don’t forget the .vbs at the end of it). Drop your script into the script pane and hit the <strong>Parameters</strong> button. The only parameters that this script needs is the service name and computer name (the computer name is used for logging the script events). Use the fly outs to add in the service name and the computer name (as the image shows below):</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-4.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-161" title="2010-06-14-4" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-4-300x255.png" alt="" width="300" height="255" /></a></p>
<p>When finished your parameter screen should look something like this:</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-5.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-162" title="2010-06-14-5" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-5-300x154.png" alt="" width="300" height="154" /></a></p>
<p>Once you have set your parameter, click <strong>OK</strong> to close the parameters window, and <strong>Next</strong> on the <strong>Script</strong> screen. Now we need to configure the unhealthy expression for our monitor. I have decided that in order for the monitor to be unhealthy the service should not be in a running state. Click the <strong>Insert</strong> button to add a condition to the screen. For the <strong>Parameter Name</strong> enter in Property[@Name=’State’] (XPath - <a href="http://www.w3schools.com/xpath/xpath_syntax.asp">http://www.w3schools.com/xpath/xpath_syntax.asp</a>) to access the <strong>state</strong> value inside the property bag, for the operator choose the <strong>does not equal</strong> qualifier, finally for the value enter in <strong>Running</strong>. When complete your expression screen should look something like this:</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-6.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-163" title="2010-06-14-6" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-6-300x25.png" alt="" width="300" height="25" /></a></p>
<p><strong>Note:</strong> ensure that you use the single quotation marks if you copy the XPath query from this post (replaces them with ‘). Click <strong>Next </strong>to continue for the <strong>Healthy Expression</strong> screen. For the service to be healthy I want it to be in a Running state. Complete the expression as follows and click <strong>Finish</strong> to complete the wizard.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-7.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-164" title="2010-06-14-7" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-7-300x26.png" alt="" width="300" height="26" /></a></p>
<p>You should now have a monitor under the <strong>Richard.CustomMP.Spooler</strong> class:</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-8.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-165" title="2010-06-14-8" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-8-300x93.png" alt="" width="300" height="93" /></a></p>
<p>We now need to configure the states of the monitor. To do this right click on the monitor and select properties, on the screen that appears click the <strong>Health</strong> tab. Ensure that the health of the monitor is set to <strong>Healthy</strong> for the healthy state and <strong>Warning</strong> for the unhealthy state:</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-91.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-167" title="2010-06-14-9" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-91-300x106.png" alt="" width="300" height="106" /></a></p>
<p>If you would like to you can configure the monitor alert when its state changes to warning (this is not covered here to save time). Click <strong>OK</strong> to close the properties dialog box and save the changes made to your management pack.</p>
<p>The final thing we will need to do is import this into our lab to ensure that our new monitor is working. Import the pack and wait until the script has run (every interval of 5 min from 12:00 am), if everything goes well the state of your <strong>Richard.CustomMP.Spooler</strong> should change to <strong>Healthy</strong>:</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-10.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-168" title="2010-06-14-10" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-10-300x59.png" alt="" width="300" height="59" /></a><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-11.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-169" title="2010-06-14-11" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-11-300x40.png" alt="" width="300" height="40" /></a></p>
<p>Try stopping the <strong>Print Spooler</strong> service on a random computer, wait 5 min and see how the state changes for the discovered instance of the <strong>Richard.CustomMP.Spooler</strong> class.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-12.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-170" title="2010-06-14-12" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-12-300x60.png" alt="" width="300" height="60" /></a><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-131.png" rel="lightbox[156]"><img class="aligncenter size-medium wp-image-172" title="2010-06-14-13" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14-131-300x39.png" alt="" width="300" height="39" /></a></p>
<p><strong>Note:</strong> I have changed the interval for the discovery (Richard.CustomMP.Spooler.Discovery.10001) to run every 1 hour as 5 min is a bit too much, but in a production environment 1 hour is still too much. That’s pretty much all there is to a script based monitor. There is a lot of content to take in with this post so maybe a second read through might make things a bit clearer. I have attached the complete management pack if you would like to see all the components in action.</p>
<p>Grab the <a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-14.zip">current management pack</a> here.</p>
<p style="text-align: right;">[<a href="http://www.rn.co.za/html/?p=100">Back to MP Index</a>]</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;submitHeadline=C-MP-3A+%3A+Creating+a+Health+Monitor&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;title=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;title=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;title=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;title=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;title=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;T=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;title=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;title=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C-MP-3A+%3A+Creating+a+Health+Monitor+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D156&amp;t=C-MP-3A+%3A+Creating+a+Health+Monitor" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=156</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C-MP-2C : Testing our custom discovery</title>
		<link>http://www.rn.co.za/html/?p=148</link>
		<comments>http://www.rn.co.za/html/?p=148#comments</comments>
		<pubDate>Fri, 11 Jun 2010 04:40:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SCOM \ OpsMgr]]></category>
		<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[MP Development]]></category>
		<category><![CDATA[Operations Manager]]></category>
		<category><![CDATA[SCOM]]></category>

		<guid isPermaLink="false">http://www.rn.co.za/html/?p=148</guid>
		<description><![CDATA[In the last post I went over the steps needed to create a custom discovery in SCOM, now we need to import the discovery into our lab to see if there are any errors with the discovery. This is simple enough; the first thing you will need to do is connect to the SCOM console [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.rn.co.za/html/?p=135">last post</a> I went over the steps needed to create a custom discovery in SCOM, now we need to import the discovery into our lab to see if there are any errors with the discovery. This is simple enough; the first thing you will need to do is connect to the SCOM console in your lab and import your MP.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11-1.png" rel="lightbox[148]"><img class="aligncenter size-medium wp-image-149" title="2010-06-11-1" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11-1-300x32.png" alt="" width="300" height="32" /></a></p>
<p>Once imported start watching the <strong>Event Viewer</strong> and keep a keen eye on the <strong>Operations Manager</strong> log.</p>
<p>In the SCOM console navigate to the <strong>Monitoring </strong>pane and select <strong>Discovered Inventory</strong>, using the <strong>Change Target Type</strong> button on the left hand pane select your new class from the list presented:</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11-2.png" rel="lightbox[148]"><img class="aligncenter size-medium wp-image-150" title="2010-06-11-2" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11-2-300x97.png" alt="" width="300" height="97" /></a></p>
<p>We now need to wait for the discovery to run (hence why I am using a 5 min interval), I am watching the event log for either an error telling me why our discovery has not run or the following event to appear:</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11-3.png" rel="lightbox[148]"><img class="aligncenter size-medium wp-image-151" title="2010-06-11-3" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11-3-300x110.png" alt="" width="300" height="110" /></a></p>
<p>The above event was the “<strong>logDiscoveryRun</strong>“ function that I added to my script – very useful.</p>
<p>If you see that the discovery has run through successfully and no errors following it, you should now be able to refresh the <strong>Discovered Inventory</strong> and see your new class populated with items.</p>
<p><a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11-4.png" rel="lightbox[148]"><img class="aligncenter size-medium wp-image-152" title="2010-06-11-4" src="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11-4-300x48.png" alt="" width="300" height="48" /></a></p>
<p>Here are some basic things to check if you are unable to run the discovery:</p>
<ol>
<li>Look in the health store if the script has been received by SCOM</li>
<li>Manually run the script with the parameters provided in the comments</li>
<li>Have a look at the <strong>run-as </strong>accounts</li>
<li>Check that the file association with <strong>vbs</strong> is not incorrectly associated</li>
<li>Ensure that the discoveries script name ends with a .vbs</li>
<li>Look to see if the computer has been getting updates</li>
<li>Check if you can connect to the target computer
<ol>
<li>Check event logs for errors</li>
<li>Check telnet connectivity to MS on port 5723</li>
<li>Check if there is a Health Store for the computer</li>
<li>Restart the SCOM service and watch for errors</li>
<li>Rebuild the Health Store</li>
<li>Check certificates if the computer is not on a domain</li>
<li>Re-Install the SCOM agent on the computer if all else fails</li>
</ol>
</li>
</ol>
<p>As you can see, the discovered items are in a not monitored state, but this is the topic for our next few posts:</p>
<ol>
<li>Creating a Health Monitor Script</li>
<li>Creating a Health Monitor</li>
</ol>
<p>I hope that you have found this informative, until the next time…</p>
<p>Click here to grab the latest version of <a href="http://www.rn.co.za/html/wp-content/uploads/2010/06/2010-06-11.zip">Richard.CustomMP</a>.</p>
<p style="text-align: right;">[<a href="http://www.rn.co.za/html/?p=100">Back to MP Index</a>]</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.bloglines.com/sub/http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148" rel="nofollow" title="Bookmark @&nbsp;Bloglines"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/bloglines.png" title="Bookmark @&nbsp;Bloglines" alt="Bookmark @&nbsp;Bloglines" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;submitHeadline=C-MP-2C+%3A+Testing+our+custom+discovery&amp;submitSummary=" rel="nofollow" title="Bookmark @&nbsp;Buzz"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/buzz.png" title="Bookmark @&nbsp;Buzz" alt="Bookmark @&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;title=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;Del.icio.us"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/delicious.png" title="Bookmark @&nbsp;Del.icio.us" alt="Bookmark @&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;title=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;Diigo"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/diigo.png" title="Bookmark @&nbsp;Diigo" alt="Bookmark @&nbsp;Diigo" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;title=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;digg"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/digg.png" title="Bookmark @&nbsp;digg" alt="Bookmark @&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148" rel="nofollow" title="Bookmark @&nbsp;Facebook"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/facebook.png" title="Bookmark @&nbsp;Facebook" alt="Bookmark @&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;title=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;Google Bookmarks"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/google.png" title="Bookmark @&nbsp;Google Bookmarks" alt="Bookmark @&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;title=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;LinkedIn"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/linkedin.png" title="Bookmark @&nbsp;LinkedIn" alt="Bookmark @&nbsp;LinkedIn" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;T=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;Netscape"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/netscape.png" title="Bookmark @&nbsp;Netscape" alt="Bookmark @&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;title=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;reddit"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/reddit.png" title="Bookmark @&nbsp;reddit" alt="Bookmark @&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;title=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;Stumble Upon"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Bookmark @&nbsp;Stumble Upon" alt="Bookmark @&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148" rel="nofollow" title="Bookmark @&nbsp;Technorati"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/technorati.png" title="Bookmark @&nbsp;Technorati" alt="Bookmark @&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148" rel="nofollow" title="Bookmark @&nbsp;Tip'd"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/tipd.png" title="Bookmark @&nbsp;Tip'd" alt="Bookmark @&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+C-MP-2C+%3A+Testing+our+custom+discovery+@+http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148" rel="nofollow" title="Bookmark @&nbsp;Twitter"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/twitter.png" title="Bookmark @&nbsp;Twitter" alt="Bookmark @&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.rn.co.za%2Fhtml%2F%3Fp%3D148&amp;t=C-MP-2C+%3A+Testing+our+custom+discovery" rel="nofollow" title="Bookmark @&nbsp;Yahoo My Web"><img class="social_img" src="http://www.rn.co.za/html/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Bookmark @&nbsp;Yahoo My Web" alt="Bookmark @&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.rn.co.za/html/?feed=rss2&amp;p=148</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
