<?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>ben.hamilton.id.au &#187; Windows</title>
	<atom:link href="http://ben.hamilton.id.au/category/windows/feed" rel="self" type="application/rss+xml" />
	<link>http://ben.hamilton.id.au</link>
	<description>what I find interesting in tech and CRM</description>
	<lastBuildDate>Sun, 13 Nov 2011 21:37:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sheepdog rounds up windows</title>
		<link>http://ben.hamilton.id.au/windows/sheepdog-rounds-up-windows?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sheepdog-rounds-up-windows</link>
		<comments>http://ben.hamilton.id.au/windows/sheepdog-rounds-up-windows#comments</comments>
		<pubDate>Sat, 27 Nov 2010 02:21:53 +0000</pubDate>
		<dc:creator>Ben Hamilton</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Laptop]]></category>
		<category><![CDATA[Netbook]]></category>
		<category><![CDATA[SheepDog]]></category>

		<guid isPermaLink="false">http://ben.hamilton.id.au/?p=304</guid>
		<description><![CDATA[One of the tools I&#8217;ve found very useful is SheepDog. Like the real world sheep dogs, it rounds things up, in this case stray windows. # Working with a laptop, I often plugin a second monitor, however, when I next &#8230; <a href="http://ben.hamilton.id.au/windows/sheepdog-rounds-up-windows">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="winerlinks-enabled"><a name="p0"></a>One of the tools I&#8217;ve found very useful is <a title="SheepDog - move offscreen windows back to the primary monitor" href="http://sheepdog.codeplex.com/">SheepDog</a>. Like the real world sheep dogs, it rounds things up, in this case stray windows. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/windows/sheepdog-rounds-up-windows#p0">#</a><p class="winerlinks-enabled"><a name="p1"></a>
Working with a laptop, I often plugin a second monitor, however, when I next fire up the laptop, windows may open up but not be visible on my laptop screen, they &#8216;remember&#8217; that they were placed on the second screen, which is no longer connected. <a title="SheepDog - move offscreen windows back to the primary monitor" href="http://sheepdog.codeplex.com/">SheepDog</a> rounds them up and moves them back to my primary monitor. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/windows/sheepdog-rounds-up-windows#p1">#</a><p class="winerlinks-enabled"><a name="p2"></a>
If you&#8217;re using a laptop or netbook, I recommend you take a look at it. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/windows/sheepdog-rounds-up-windows#p2">#</a>]]></content:encoded>
			<wfw:commentRss>http://ben.hamilton.id.au/windows/sheepdog-rounds-up-windows/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using registry values in scripts</title>
		<link>http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-registry-values-in-scripts</link>
		<comments>http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#comments</comments>
		<pubDate>Sun, 22 Aug 2010 11:30:10 +0000</pubDate>
		<dc:creator>Ben Hamilton</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Registry]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://ben.hamilton.id.au/?p=265</guid>
		<description><![CDATA[I&#8217;m often writing scripts to do stuff. It makes my job easier. I&#8217;ve often wanted to be able to script the discovery of registry values in the Windows Registry. # Thus here is a short example on using the vanilla &#8230; <a href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="winerlinks-enabled"><a name="p0"></a>I&#8217;m often writing scripts to do stuff. It makes my job easier. I&#8217;ve often wanted to be able to script the discovery of registry values in the Windows Registry. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p0">#</a><p class="winerlinks-enabled"><a name="p1"></a>
Thus here is a short example on using the vanilla windows command line to find the value of a Windows registry key. From my testing these commands are all present by default in Windows XP, Vista, 7, Server 2003 and Server 2008. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p1">#</a><p class="winerlinks-enabled"><a name="p2"></a>
Assume we want to find the Microsoft Windows Common Files directory. Using `Regedit` we can find that here: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CommonFilesDir` <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p2">#</a><p class="winerlinks-enabled"><a name="p3"></a>
So the first thing we want to do is query the registry, we do that with the command line tool `reg` as follows ([more about reg][]): <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p3">#</a><p class="winerlinks-enabled"><a name="p4"></a>
[more about reg]:http://www.petri.co.il/reg_command_in_windows_xp.htm<br />
&#8220;Read up on how to use the reg command for more than just a query&#8221; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p4">#</a><p class="winerlinks-enabled"><a name="p5"></a>
`reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion /v CommonFilesDir >1.tmp` <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p5">#</a><p class="winerlinks-enabled"><a name="p6"></a>
This will spit out the following into the text file `1.tmp`: <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p6">#</a><p class="winerlinks-enabled"><a name="p7"></a>
&#8212; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p7">#</a><p class="winerlinks-enabled"><a name="p8"></a>
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion<br />
    CommonFilesDir    REG_SZ    C:\Program Files\Common Files <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p8">#</a><p class="winerlinks-enabled"><a name="p9"></a>
&#8212; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p9">#</a><p class="winerlinks-enabled"><a name="p10"></a>
However, this isn&#8217;t of much use in a script. Really, we just want the value of the folder itself, not all the extra info. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p10">#</a><p class="winerlinks-enabled"><a name="p11"></a>
So what we do is use the command line tool &#8216;findstr&#8217; which essentially is a windows regex tool ([more about findstr][]). We use it to do this: <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p11">#</a><p class="winerlinks-enabled"><a name="p12"></a>
[more about findstr]:http://www.netexpertise.eu/en/windows/findstr-an-alternative-to-grep.html<br />
&#8220;Read up on findstr &#8211; regex goodness on windows by default&#8221; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p12">#</a><p class="winerlinks-enabled"><a name="p13"></a>
`findstr /r REG_SZ 1.tmp >2.tmp` <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p13">#</a><p class="winerlinks-enabled"><a name="p14"></a>
This spits out just the line that contains REG_SZ and puts it into the text file `2.tmp`. Now that we&#8217;ve just just the one line, we want to strip the first 32 characters off it. We do this by first setting it as an enviroment variale and then trimming it down using the following two commands ([more on set][]): <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p14">#</a><p class="winerlinks-enabled"><a name="p15"></a>
[more on set]:http://www.computing.net/answers/windows-2000/use-file-contents-to-set-variables/63174.html<br />
&#8220;Using file contents to set enviroment variables&#8221; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p15">#</a><p class="winerlinks-enabled"><a name="p16"></a>
`set /p CommFiles=<2.tmp` <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p16">#</a><p class="winerlinks-enabled"><a name="p17"></a>
And then we shorten that ([more on trimming][]): <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p17">#</a><p class="winerlinks-enabled"><a name="p18"></a>
[more on trimming]:http://www.dostips.com/DtTipsStringManipulation.php<br />
"Read up on using set to trim environment variables" <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p18">#</a><p class="winerlinks-enabled"><a name="p19"></a>
`set CommFiles=%CommFiles:~32%` <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p19">#</a><p class="winerlinks-enabled"><a name="p20"></a>
Then we can echo the result to the screen using: <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p20">#</a><p class="winerlinks-enabled"><a name="p21"></a>
`Echo The Common Files directory is: %CommFiles%` <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p21">#</a><p class="winerlinks-enabled"><a name="p22"></a>
And here it is all in one easy to copy set: <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p22">#</a><p class="winerlinks-enabled"><a name="p23"></a>
--- <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p23">#</a><p class="winerlinks-enabled"><a name="p24"></a>
    Set CommFiles=C:\Temp<br />
    reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion /v CommonFilesDir >1.tmp<br />
    findstr /r REG_SZ 1.tmp >2.tmp<br />
    set /p CommFiles=<2.tmp<br />
    set CommFiles=%CommFiles:~32%<br />
    Echo The Common Files directory is: %CommFiles% <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p24">#</a><p class="winerlinks-enabled"><a name="p25"></a>
&#8212; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p25">#</a><p class="winerlinks-enabled"><a name="p26"></a>
With a little editing I&#8217;m sure that you can turn this to your own uses, pulling out the value of registry keys and using them in script files. You&#8217;re not limited to this registry key, you can use it to access all sorts of registry keys. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p26">#</a><p class="winerlinks-enabled"><a name="p27"></a>
Please do tell me what uses you put this to. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p27">#</a><p class="winerlinks-enabled"><a name="p28"></a>
Enjoy. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts#p28">#</a>]]></content:encoded>
			<wfw:commentRss>http://ben.hamilton.id.au/microsoft/using-registry-values-in-scripts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding user SID</title>
		<link>http://ben.hamilton.id.au/microsoft/finding-user-sid?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=finding-user-sid</link>
		<comments>http://ben.hamilton.id.au/microsoft/finding-user-sid#comments</comments>
		<pubDate>Sun, 22 Aug 2010 10:13:07 +0000</pubDate>
		<dc:creator>Ben Hamilton</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[SID]]></category>

		<guid isPermaLink="false">http://ben.hamilton.id.au/?p=261</guid>
		<description><![CDATA[Occasionally you may want to know the [SID][] of a windows user. If that made no sense to you, read no futher, this snippet is not for you. # [SID]:http://encyclopedia.thefreedictionary.com/Security+Identifier &#8220;Read a definition of what the SID is&#8221; # Open &#8230; <a href="http://ben.hamilton.id.au/microsoft/finding-user-sid">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="winerlinks-enabled"><a name="p0"></a>Occasionally you may want to know the [SID][] of a windows user. If that made no sense to you, read no futher, this snippet is not for you. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p0">#</a><p class="winerlinks-enabled"><a name="p1"></a>
[SID]:http://encyclopedia.thefreedictionary.com/Security+Identifier<br />
&#8220;Read a definition of what the SID is&#8221; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p1">#</a><p class="winerlinks-enabled"><a name="p2"></a>
Open up REGEDIT and browse to this key: <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p2">#</a><p class="winerlinks-enabled"><a name="p3"></a>
`HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList` <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p3">#</a><p class="winerlinks-enabled"><a name="p4"></a>
Here you will find a list of SID&#8217;s, under each is a subkey containing the name of the user it is associated with. Run through them until you find the username you&#8217;re looking for and bingo, it&#8217;s parent key is that users SID. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p4">#</a><p class="winerlinks-enabled"><a name="p5"></a>
Found via [petri.co.il][] <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p5">#</a><p class="winerlinks-enabled"><a name="p6"></a>
[petri.co.il]:http://www.petri.co.il/forums/showthread.php?t=21332\<br />
&#8220;petri.co.il is a wealth of tech goodness&#8221; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p6">#</a><p class="winerlinks-enabled"><a name="p7"></a>
[Bonus link][] <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p7">#</a><p class="winerlinks-enabled"><a name="p8"></a>
[Bonus link]:https://secure.wikimedia.org/wikipedia/en/wiki/Security_Identifier<br />
&#8220;More explaination of SID&#8217;s, decoding them etc&#8221; <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/microsoft/finding-user-sid#p8">#</a>]]></content:encoded>
			<wfw:commentRss>http://ben.hamilton.id.au/microsoft/finding-user-sid/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Turn off Enhanced Security</title>
		<link>http://ben.hamilton.id.au/how-to/turn-off-enhanced-security?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=turn-off-enhanced-security</link>
		<comments>http://ben.hamilton.id.au/how-to/turn-off-enhanced-security#comments</comments>
		<pubDate>Mon, 09 Feb 2009 03:44:26 +0000</pubDate>
		<dc:creator>Ben Hamilton</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://ben.hamilton.id.au/?p=155</guid>
		<description><![CDATA[Just had need of this article, method #2 describes how to turn of Microsoft Internet Explorer Enhanced Security Configuration. #]]></description>
			<content:encoded><![CDATA[<p class="winerlinks-enabled"><a name="p0"></a>Just had need of this article, method #2 describes <a href="http://kbalertz.com/933991/Standard-users-cannot-Internet-Explorer-Enhanced-Security-feature-Windows-Server-terminal-server.aspx">how to turn of Microsoft Internet Explorer Enhanced Security Configuration</a>. <a ref="permalink" title="Permalink to this paragraph" class="winerlink" href="http://ben.hamilton.id.au/how-to/turn-off-enhanced-security#p0">#</a>]]></content:encoded>
			<wfw:commentRss>http://ben.hamilton.id.au/how-to/turn-off-enhanced-security/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

