<?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>Huddled Masses &#187; Windows</title>
	<atom:link href="http://huddledmasses.org/tag/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://huddledmasses.org</link>
	<description>You can do more than breathe for free...</description>
	<lastBuildDate>Fri, 27 Apr 2012 05:42:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<cloud domain='huddledmasses.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>The problem with calling legacy/native apps from PowerShell</title>
		<link>http://huddledmasses.org/the-problem-with-calling-legacy-or-native-apps-from-powershell/</link>
		<comments>http://huddledmasses.org/the-problem-with-calling-legacy-or-native-apps-from-powershell/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 22:16:14 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Interoperability]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://huddledmasses.org/?p=1664</guid>
		<description><![CDATA[This post is an explanation of the major problems with invoking native apps from PowerShell 2.0, and the simple work-around. There is going to be a little bit of code and then quite a bit of sample output (along with some pointers so you don&#8217;t have to play spot the differences). In order to avoid [...]]]></description>
			<content:encoded><![CDATA[	<p>This post is an explanation of the major problems with invoking native apps from PowerShell 2.0, and the simple work-around.  There is going to be a little bit of code and then quite a bit of sample output (along with some pointers so you don&#8217;t have to play spot the differences). In order to avoid keeping you waiting while I get to the workaround, I&#8217;ll let out the secret right here at the top, because it is really very simple: use Start-Process and a here-string to make sure PowerShell does not mess with your arguments (more on this later).</p>

	<p>So, first, to demonstrate the differences, lets create an executable which will use various methods to access its command-line parameters and print them out.  We will do this in C# although you could do it in C++ and see some variations because the .Net runtime does some parsing of it&#8217;s own, which is a little weird &#8212; but this simple example should be enough to demonstrate the differences.</p>

	<p>The code here is in PowerShell format, so you can simply paste it into PowerShell and get an executable as output, which you can then move to C:\Windows\System32 for testing purposes.</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #0066cc; font-style: italic;">Add-<span style="font-style: normal;">Type</span></span> <span style="color: #000066;">-Type</span> @<span style="color: #009900;">&quot;<br />
using System;<br />
internal class ArgsTest <br />
{<br />
&nbsp; &nbsp;private static void Main(string[] args)<br />
&nbsp; &nbsp;{<br />
&nbsp; &nbsp; &nbsp; Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; /* <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;I've commented this out because (at least in C#)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;it is the same as Environment.GetCommandLineArgs() <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Except that GetCommandLineArgs shows parameter 0 as the executable path<br />
&nbsp; &nbsp; &nbsp; */<br />
&nbsp; &nbsp; &nbsp; // Console.WriteLine(&quot;</span><span style="color: #666699; font-weight: bold;">Using</span> args:<span style="color: #009900;">&quot;);<br />
&nbsp; &nbsp; &nbsp; // Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; // for (int i = 0; i &lt; args.Length; i++)<br />
&nbsp; &nbsp; &nbsp; // {<br />
&nbsp; &nbsp; &nbsp; // &nbsp; &nbsp;Console.WriteLine(&quot;</span> &nbsp; Arg <span style="color: #333;">&#123;</span><span style="color: #cc66cc;">0</span><span style="color: #333;">&#125;</span> <span style="color: #333399; font-weight: bold; font-style: italic;">is</span>: <span style="color: #333;">&#123;</span><span style="color: #cc66cc;">1</span><span style="color: #333;">&#125;</span><span style="color: #009900;">&quot;, i, args[i]);<br />
&nbsp; &nbsp; &nbsp; // }<br />
&nbsp; &nbsp; &nbsp; // Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; // Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;</span>CommandLine:<span style="color: #009900;">&quot;);<br />
&nbsp; &nbsp; &nbsp; Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;</span> &nbsp; <span style="color: #009900;">&quot; + Environment.CommandLine);<br />
&nbsp; &nbsp; &nbsp; Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;</span>CommandLineArgs:<span style="color: #009900;">&quot;);<br />
&nbsp; &nbsp; &nbsp; Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; string[] arguments = Environment.GetCommandLineArgs();<br />
&nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; arguments.Length; i++)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Console.WriteLine(&quot;</span> &nbsp; Arg <span style="color: #333;">&#123;</span><span style="color: #cc66cc;">0</span><span style="color: #333;">&#125;</span> <span style="color: #333399; font-weight: bold; font-style: italic;">is</span>: <span style="color: #333;">&#123;</span><span style="color: #cc66cc;">1</span><span style="color: #333;">&#125;</span><span style="color: #009900;">&quot;, i, arguments[i]);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; Console.WriteLine();<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; System.Threading.Thread.Sleep(10000);<br />
&nbsp; &nbsp;}<br />
}<br />
&quot;</span>@ <span style="color: #000066;">-OutputAssembly</span> ArgsTest.<span style="color: #003366;">exe</span> <span style="color: #000066;">-OutputType</span> ConsoleApplication<br />
&nbsp;</div>

	<p>To test things, we are going to invoke it in PowerShell, in <span class="caps">CMD</span>.exe (<span class="caps">DOS</span>), and using the Run dialog (and finally, using Start-Process, to demonstrate that it has the same output as the Run dialog).</p>

	<h2>A note about path problems</h2>

	<p>In order to see the differences in how paths are handled, I put ArgsTest.exe in C:\Windows\System32\ &#8212; this allows me to call it with no path at all, with a full path, or with a partial path.  That turned out to be important because <span class="highlight">the first difference of PowerShell is that it <strong>always</strong> executes the app with a <span class="caps">FULL</span> path, even if you&#8217;re calling it with a partial path</span>.  </p>

	<p>The reason for this is simple: PowerShell doesn&#8217;t ever set the &#8220;CurrentDirectory&#8221; in it&#8217;s operating evironment when you Set-Location (presumably because they figured that often that location would be in a non-FileSystem provider).  Because it doesn&#8217;t set the current directory, it always needs to invoke applications and scripts with their full path name.</p>

	<h2>The test case</h2>

	<p>We will execute the following (long) command-line:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
ArgsTest.<span style="color: #003366;">exe</span> <span style="color: #000066;">-this</span> <span style="color: #333399; font-weight: bold; font-style: italic;">is</span>, a, <span style="color: #660033; font-weight: bold;">$Home</span>, <span style="color: #66cc66;">%</span>UserProfile<span style="color: #66cc66;">%</span> &nbsp; <span style="color: #66cc66;">/</span>test &nbsp;<span style="color: #000066;">-extra</span> spaces <span style="color: #66cc66;">/</span>slashes:<span style="color: #009900;">&quot;including spaces&quot;</span> <span style="color: #000066;">-dashes</span>:<span style="color: #009900;">&quot;including 'quotes'&quot;</span> <span style="color: #000066;">-and</span>:<span style="color: #009900;">'some colons'</span> <span style="color: #66cc66;">/</span>with:<span style="color: #009900;">'single $Home quotes'</span><br />
&nbsp;</div>

	<p>And to get us started, lets look at what that looks like when you execute it from cmd:</p>

	<div class="none code none" style="font-family:monospace;"><br />
CommandLine:<br />
<br />
&nbsp; &nbsp;ArgsTest.exe &nbsp;-this is, a, $Home, C:\Users\jbennett &nbsp; /test &nbsp;-extra spaces /slashes:&quot;including spaces&quot; -dashes:&quot;including 'quotes'&quot; -and:'some colons' /with:'single $Home quotes'<br />
<br />
<br />
CommandLineArgs:<br />
<br />
&nbsp; &nbsp;Arg 0 is: ArgsTest.exe<br />
&nbsp; &nbsp;Arg 1 is: -this<br />
&nbsp; &nbsp;Arg 2 is: is,<br />
&nbsp; &nbsp;Arg 3 is: a,<br />
&nbsp; &nbsp;Arg 4 is: $Home,<br />
&nbsp; &nbsp;Arg 5 is: C:\Users\jbennett<br />
&nbsp; &nbsp;Arg 6 is: /test<br />
&nbsp; &nbsp;Arg 7 is: -extra<br />
&nbsp; &nbsp;Arg 8 is: spaces<br />
&nbsp; &nbsp;Arg 9 is: /slashes:including spaces<br />
&nbsp; &nbsp;Arg 10 is: -dashes:including 'quotes'<br />
&nbsp; &nbsp;Arg 11 is: -and:'some<br />
&nbsp; &nbsp;Arg 12 is: colons'<br />
&nbsp; &nbsp;Arg 13 is: /with:'single<br />
&nbsp; &nbsp;Arg 14 is: $Home<br />
&nbsp; &nbsp;Arg 15 is: quotes'<br />
&nbsp;</div>

	<p>Notice that in this output, Environment.CommandLine is exactly what was typed!<br />
Now, let&#8217;s see the same thing from the run dialog:</p>

	<div class="none code none" style="font-family:monospace;"><br />
CommandLine:<br />
<br />
&nbsp; &nbsp;&quot;C:\Windows\system32\ArgsTest.exe&quot; -this is, a, $Home, C:\Users\jbennett &nbsp; /test &nbsp;-extra spaces /slashes:&quot;including spaces&quot; -dashes:&quot;including 'quotes'&quot; -and:'some colons' /with:'single $Home quotes'<br />
<br />
<br />
CommandLineArgs:<br />
<br />
&nbsp; &nbsp;Arg 0 is: C:\Windows\system32\ArgsTest.exe<br />
&nbsp; &nbsp;Arg 1 is: -this<br />
&nbsp; &nbsp;Arg 2 is: is,<br />
&nbsp; &nbsp;Arg 3 is: a,<br />
&nbsp; &nbsp;Arg 4 is: $Home,<br />
&nbsp; &nbsp;Arg 5 is: C:\Users\jbennett<br />
&nbsp; &nbsp;Arg 6 is: /test<br />
&nbsp; &nbsp;Arg 7 is: -extra<br />
&nbsp; &nbsp;Arg 8 is: spaces<br />
&nbsp; &nbsp;Arg 9 is: /slashes:including spaces<br />
&nbsp; &nbsp;Arg 10 is: -dashes:including 'quotes'<br />
&nbsp; &nbsp;Arg 11 is: -and:'some<br />
&nbsp; &nbsp;Arg 12 is: colons'<br />
&nbsp; &nbsp;Arg 13 is: /with:'single<br />
&nbsp; &nbsp;Arg 14 is: $Home<br />
&nbsp; &nbsp;Arg 15 is: quotes'<br />
&nbsp;</div>

	<p>The thing I want you to notice is that the results are <em>almost</em> exactly the same.  The only difference is that cmd shows you just &#8220;ArgsTest.exe&#8221; which is what was actually typed, whereas the Run dialog inserts the full path to the executable.</p>

	<p>But now, take a look at that same command in PowerShell:</p>

	<div class="none code none" style="font-family:monospace;"><br />
CommandLine:<br />
<br />
&nbsp; &nbsp;&quot;C:\Windows\system32\ArgsTest.exe&quot; &nbsp;-this is a C:\Users\jbennett %UserProfile% /test -extra spaces &quot;/slashes:including spaces&quot; &quot;-dashes:&quot;including 'quotes'&quot;&quot; &quot;-and:&quot;some colons&quot;&quot; &quot;/with:single $Home quotes&quot;<br />
<br />
<br />
CommandLineArgs:<br />
<br />
&nbsp; &nbsp;Arg 0 is: C:\Windows\system32\ArgsTest.exe<br />
&nbsp; &nbsp;Arg 1 is: -this<br />
&nbsp; &nbsp;Arg 2 is: is<br />
&nbsp; &nbsp;Arg 3 is: a<br />
&nbsp; &nbsp;Arg 4 is: C:\Users\jbennett<br />
&nbsp; &nbsp;Arg 5 is: %UserProfile%<br />
&nbsp; &nbsp;Arg 6 is: /test<br />
&nbsp; &nbsp;Arg 7 is: -extra<br />
&nbsp; &nbsp;Arg 8 is: spaces<br />
&nbsp; &nbsp;Arg 9 is: /slashes:including spaces<br />
&nbsp; &nbsp;Arg 10 is: -dashes:including<br />
&nbsp; &nbsp;Arg 11 is: 'quotes'<br />
&nbsp; &nbsp;Arg 12 is: -and:some<br />
&nbsp; &nbsp;Arg 13 is: colons<br />
&nbsp; &nbsp;Arg 14 is: /with:single $Home quotes<br />
&nbsp;</div>

	<h2>A Diagnosis</h2>

	<p>The one thing we expected, of course, is that Powershell interpreted the $Home variable instead of the <span>UserProfile</span> variable, but that&#8217;s <em>hardly</em> the most significant difference &#8230;</p>

	<p>In an attempt to translate what you wrote into what <strong>they think</strong> you meant, PowerShell has rewritten all of the quoting in the command line!</p>

	<ul>
		<li>First, since PowerShell understands that commas are simply array separators, they simply remove them completely when calling a &#8220;native&#8221; app. PowerShell is actually taking the array, and converting the array into a string with space separators.  They don&#8217;t seem to respect <code>$OFS</code> when doing this, so I don&#8217;t really know what the justification is for doing it.</li>
		<li>Second, PowerShell changes single quoted strings into double quoted strings (without expanding the variables) to make sure that what PowerShell thinks of as strings are also thought of as strings by the target application (of course, they wouldn&#8217;t be strings in <span class="caps">DOS</span>, but this is PowerShell). If your executable depends on getting single quotes in the arguments, you&#8217;re going to have some pain because of that, otherwise, you won&#8217;t even notice.</li>
		<li>Third, PowerShell actually <span class="caps">MOVES</span> some quotes, like the one after /slashes &#8230; Obviously PowerShell doesn&#8217;t treat / as a switch, so it treats them as any other string character. Since in PowerShell, if you don&#8217;t quote the <span class="caps">WHOLE</span> string, you can still start quoting halfway through it when you realize you need to type spaces &#8230; they move the quote to the start of the string so that your app will see the same thing a cmdlet would have. </li>
	</ul>
	<ul>
		<li>Finally, PowerShell <span class="caps">INSERTS</span> extra quotes around -dashes.  <em>This is the one thing I can&#8217;t really explain right now.</em> PowerShell inserts extra quotes which result in what looks like a real problem in the CommandLine string due to double-double quotes &#8230; but somehow those escape parsing as an escaped double quote character when you look at the output of GetCommandLineArgs.</li>
	</ul>

	<h2>Work arounds</h2>

	<p>You can get the same results from GetCommandLineArgs when invoking from a PowerShell command by quoting your single quotes and commas, knowing that you need to use $Env: instead of %%, and escaping your dollar signs:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
ArgsTest.<span style="color: #003366;">exe</span> <span style="color: #000066;">-this</span> <span style="color: #009900;">&quot;is,&quot;</span> <span style="color: #009900;">&quot;a,&quot;</span> <span style="color: #009900;">&quot;<span style="color: #000099; font-weight: bold;">`$</span>Home,&quot;</span> <span style="color: #660033; font-weight: bold;">$Env</span>:UserProfile &nbsp; <span style="color: #66cc66;">/</span>test &nbsp;<span style="color: #000066;">-extra</span> spaces <span style="color: #66cc66;">/</span>slashes:<span style="color: #009900;">&quot;including spaces&quot;</span> <span style="color: #009900;">&quot;-dashes:including 'quotes'&quot;</span> <span style="color: #009900;">&quot;-and:'some&quot;</span> <span style="color: #009900;">&quot;colons'&quot;</span> <span style="color: #009900;">&quot;/with:'single&quot;</span> `<span style="color: #660033; font-weight: bold;">$Home</span> <span style="color: #009900;">&quot;quotes'&quot;</span><br />
&nbsp;</div>

	<p>However, if the app you&#8217;re calling relies on parsing CommandLine, instead of using args[] or GetCommandLineArgs(), then you have to do it differently, and you can&#8217;t ever know that until you try it&#8230;</p>

	<p>The best workaround, therefore is to use Start-Process.  Of course, if you have <span>UserProfile</span> or other environment variables, then you still have to replace those with $Env: and escape your other dollar signs, but if you don&#8217;t &#8230; you can just use a single-quote here-string.  Note the minor difference:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Process</span></span> ArgsTest @<span style="color: #009900;">'<br />
-this is, a, $Home, %UserProfile% &nbsp; /test &nbsp;-extra spaces /slashes:&quot;including spaces&quot; -dashes:&quot;including '</span>quotes<span style="color: #009900;">'&quot; -and:'</span>some colons<span style="color: #009900;">' /with:'</span><span style="color: #003366; font-weight: bold;">single</span> <span style="color: #660033; font-weight: bold;">$Home</span> quotes<span style="color: #009900;">'<br />
'</span>@<br />
&nbsp;</div>

	<div class="none code none" style="font-family:monospace;"><br />
CommandLine:<br />
<br />
&nbsp; &nbsp;&quot;C:\Windows\system32\ArgsTest.exe&quot; -this is, a, $Home, %UserProfile% &nbsp; /test &nbsp;-extra spaces /slashes:&quot;including spaces&quot; -dashes:&quot;including 'quotes'&quot; -and:'some colons' /with:'single $Home quotes'<br />
<br />
<br />
CommandLineArgs:<br />
<br />
&nbsp; &nbsp;Arg 0 is: C:\Windows\system32\ArgsTest.exe<br />
&nbsp; &nbsp;Arg 1 is: -this<br />
&nbsp; &nbsp;Arg 2 is: is,<br />
&nbsp; &nbsp;Arg 3 is: a,<br />
&nbsp; &nbsp;Arg 4 is: $Home,<br />
&nbsp; &nbsp;Arg 5 is: %UserProfile%<br />
&nbsp; &nbsp;Arg 6 is: /test<br />
&nbsp; &nbsp;Arg 7 is: -extra<br />
&nbsp; &nbsp;Arg 8 is: spaces<br />
&nbsp; &nbsp;Arg 9 is: /slashes:including spaces<br />
&nbsp; &nbsp;Arg 10 is: -dashes:including 'quotes'<br />
&nbsp; &nbsp;Arg 11 is: -and:'some<br />
&nbsp; &nbsp;Arg 12 is: colons'<br />
&nbsp; &nbsp;Arg 13 is: /with:'single<br />
&nbsp; &nbsp;Arg 14 is: $Home<br />
&nbsp; &nbsp;Arg 15 is: quotes'<br />
&nbsp;</div>

	<h4>And finally, we have it!</h4>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Process</span></span> ArgsTest @<span style="color: #009900;">&quot;<br />
-this is, a, <span style="color: #000099; font-weight: bold;">`$</span>Home, $Env:UserProfile &nbsp; /test &nbsp;-extra spaces /slashes:&quot;</span>including spaces<span style="color: #009900;">&quot; -dashes:&quot;</span>including <span style="color: #009900;">'quotes'</span><span style="color: #009900;">&quot; -and:'some colons' /with:'single <span style="color: #000099; font-weight: bold;">`$</span>Home quotes'<br />
&quot;</span>@<br />
&nbsp;</div>

	<div class="plain code plain" style="font-family:monospace;"><br />
CommandLine:<br />
<br />
&nbsp; &nbsp;&quot;C:\Windows\system32\ArgsTest.exe&quot; -this is, a, $Home, C:\Users\jbennett &nbsp; /test &nbsp;-extra spaces /slashes:&quot;including spaces&quot; -dashes:&quot;including 'quotes'&quot; -and:'some colons' /with:'single $Home quotes' <br />
<br />
<br />
CommandLineArgs:<br />
<br />
&nbsp; &nbsp;Arg 0 is: C:\Windows\system32\ArgsTest.exe<br />
&nbsp; &nbsp;Arg 1 is: -this<br />
&nbsp; &nbsp;Arg 2 is: is,<br />
&nbsp; &nbsp;Arg 3 is: a,<br />
&nbsp; &nbsp;Arg 4 is: $Home,<br />
&nbsp; &nbsp;Arg 5 is: C:\Users\jbennett<br />
&nbsp; &nbsp;Arg 6 is: /test<br />
&nbsp; &nbsp;Arg 7 is: -extra<br />
&nbsp; &nbsp;Arg 8 is: spaces<br />
&nbsp; &nbsp;Arg 9 is: /slashes:including spaces<br />
&nbsp; &nbsp;Arg 10 is: -dashes:including 'quotes'<br />
&nbsp; &nbsp;Arg 11 is: -and:'some<br />
&nbsp; &nbsp;Arg 12 is: colons'<br />
&nbsp; &nbsp;Arg 13 is: /with:'single<br />
&nbsp; &nbsp;Arg 14 is: $Home<br />
&nbsp; &nbsp;Arg 15 is: quotes'<br />
<br />
&nbsp;</div>

	<p>As you can see, the only difference is the value in Arg 5 &#8230; but this last attempt actually results in a completely compatible CommandLine and CommandLineArgs. Of course, if you need to capture the output, then you need to append: <code>-Wait -RedirectStandardOutput StdOut.log; gc StdOut.log</code> &#8230; but that won&#8217;t work if you need to use the application interactively (although, if you just want to script an interactive app, there is also a <code>-RedirectStandardInput</code> parameter).</p>

	<p>In any case, if your app is non-interactive, you can use something like this:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #66cc66;">&amp;</span><span style="color: #333;">&#123;</span> <br />
<span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Process</span></span> ArgsTest @<span style="color: #009900;">&quot;<br />
-this is, a, <span style="color: #000099; font-weight: bold;">`$</span>Home, $Env:UserProfile &nbsp; /test &nbsp;-extra spaces /slashes:&quot;</span>including spaces<span style="color: #009900;">&quot; -dashes:&quot;</span>including <span style="color: #009900;">'quotes'</span><span style="color: #009900;">&quot; -and:'some colons' /with:'single <span style="color: #000099; font-weight: bold;">`$</span>Home quotes'<br />
&quot;</span>@ <span style="color: #000066;">-NoNewWindow</span> <span style="color: #000066;">-Wait</span> <span style="color: #000066;">-RedirectStandardOutput</span> stdout.<span style="color: #003366;">log</span>; <span style="color: #660033;">gc</span> stdout.<span style="color: #003366;">log</span>; <span style="color: #660033;">rm</span> stdout.<span style="color: #003366;">log</span><br />
<span style="color: #333;">&#125;</span><br />
&nbsp;</div>

	<h4>But still</h4>

	<p>If you need to run an app in the PowerShell window, interact with it (e.g.: answer a prompt), and then capture, process, or redirect the output &#8230; you need to invoke the app &#8220;natively&#8221; ... not using Start-Process. The bottom line is that PowerShell <em>still</em> needs a way to invoke apps that works as simply as Start-Process, but that invokes them inline in the shell.  In the meantime, you should generate that <code>ArgsTest</code> executable (<a href="http://PoshCode.org/get/2555">from poshcode</a>) to help you figure out the right combination of quotation magic to convince PowerShell 2.0 to pass the right values!</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/the-problem-with-calling-legacy-or-native-apps-from-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Long-Path Module (Experimental.IO)</title>
		<link>http://huddledmasses.org/long-path-module-experimental-io/</link>
		<comments>http://huddledmasses.org/long-path-module-experimental-io/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 06:01:23 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[Path]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://huddledmasses.org/?p=1651</guid>
		<description><![CDATA[Thanks to a late night on my part, and the efforts of the developers on the Microsoft BCL project who wrote the Experimental.IO LongPath assembly &#8230; with no further ado, I present a really basic module for dealing with long file paths. There&#8217;s no help yet, and very little error handling. But if you needed [...]]]></description>
			<content:encoded><![CDATA[	<p>Thanks to a late night on my part, and the efforts of the developers on the <a href="http://bcl.codeplex.com/">Microsoft <span class="caps">BCL</span> project</a> who wrote the Experimental.IO <a href="http://bcl.codeplex.com/releases/view/42783">LongPath</a> assembly &#8230; with no further ado, I present a really basic module for dealing with long file paths. </p>

	<p>There&#8217;s no help yet, and very little error handling. But if you needed long paths (I know one of you did, because Jacques Willemen asked for it), then here are: Get-LongPath, Copy-LongPath, Move-LongPath, Remove-LongPath, Get-ContentLongPath, Set-ContentLongPath &#8230; and &#8230; uhm &#8230; Format-Color</p>

	<p><a href="http://HuddledMasses.org/downloads/Experimental.IO.zip">Download the Experimental.IO Long Path Module</a></p>

	<p>The script source is <a href="http://poshcode.org/2488">on PoshCode</a> so please help me: write the next version of this module by contributing there.</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/long-path-module-experimental-io/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First Impressions of Windows 7</title>
		<link>http://huddledmasses.org/first-impressions-of-windows-7/</link>
		<comments>http://huddledmasses.org/first-impressions-of-windows-7/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 15:21:28 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[System Tray]]></category>
		<category><![CDATA[Taskbar]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows Shell]]></category>
		<category><![CDATA[Windows Vista]]></category>

		<guid isPermaLink="false">http://huddledmasses.org/?p=998</guid>
		<description><![CDATA[So, I wrote up this great explanation about how much the Shell in Windows 7 has changed from Vista, and how this shows that this Windows 7 beta is a much bigger deal than most of the whiners in the press are giving it credit for being, and explain about how I used to be [...]]]></description>
			<content:encoded><![CDATA[	<p>So, I wrote up this great explanation about how much the Shell in Windows 7 has changed from Vista, and how this shows that this Windows 7 beta is a much bigger deal than most of the whiners in the press are giving it credit for being, and explain about how I used to be a <a href="http://geoshell.org">shell</a> developer, and how that means I should have credibility when it comes to discussing changes in the taskbar, systray, desktop, and their various preference panels &#8230;.</p>

	<h3>Then Windows 7 bluescreened</h3>

	<p>I think the drivers for Mesh, (maybe VirtualCloneDrive, or Eset&#8217;s NOD32) ... didn&#8217;t like going into hibernation.  Anyway, I lost all that, so let me just list for you some of the changes <em>just</em> in the shell.  I&#8217;m going to ignore the multi-touch capability, and &#8220;Homegroup&#8220;s, and the &#8220;Libraries&#8221; that are really impressive if you&#8217;ve never learned how to make a junction &#8230; </p>

	<ol>
		<li>You have complete control over what icons show in the systray. By default, new apps don&#8217;t get to show you anything. Hurrah!
		<li>You can chose large icons for task bar.  Actually, it defaults to large icons, so I guess I should say you can choose small icons, but since that&#8217;s all that was available in previous versions of Windows, it seems like the new stuff should be what I mentioned. Oh, you know what these larger icons mean?</li>
	<ol>
		<li>The systray clock now shows the date by default (hurrah!). Ok, I know that&#8217;s not actually a big change, but it&#8217;s a tiny thing that makes me happier.</li>
		<li>Each running process gets exactly <span class="caps">ONE</span> (squarish) tile on the task bar, with a little extra ridge on the side if it represents more than one window.  Of course, that&#8217;s just the default:  
		<li>You can switch the text labels back on to make things look like before</li>
	</ol></li>
	<ol>
		<li>You can turn off the &#8220;grouping&#8221; so each window gets it&#8217;s own button</li>
	</ol></li>
		<li>You can drag tasks on the taskbar to reorder them.  I&#8217;ve been using <a href="http://taskix.robustit.com">Taskix</a> as one of my first installs for years, so this isn&#8217;t as big a deal as it could be, but it&#8217;s pretty interesting, when you combine it with:</li>
		<li>You can use WIN+<number> to launch another copy of a task (based on the order they&#8217;re in on the taskbar).  Incidentally, if anyone from the team is listening, you should focus the already running task, if there is one, so that pressing Win+# is like clicking the button.  Oh, and WIn+Shift+# could run a new one.</li>
		<li>Mousing over a taskbar tile pops out a pane with thumbnails of each window (or tabs), and mousing over the thumbnails actually hides all the other windows so you can see just that window (or tab) ... and there&#8217;s even a close button, so you can close the ones you don&#8217;t want without switching to them</li>
		<li>Dragging a window to a screen edge lets you tile it in place, or maximize it. Cool, and <em>about time</em> ... really we need a few other options on this too, and it should work on the &#8220;inside&#8221; edges of a multi-monitor setup (hopefully they&#8217;ll fix that).</li>
		<li>The right-click menu for a task tile is customizable: it can show you a list of things to chose from to open in that app: like your recent folders (file manager), your recent history (browser), your &#8220;status&#8221; (instant messenger), etc.</li>
		<li>There&#8217;s (almost always) a button on that right-click menu for launching another copy of the app. And you can right-click it to get the &#8220;run as admin&#8221;</li>
		<li>The task bar tiles can show (become, really) a progress bar!  I can&#8217;t explain how cool this is, or how many other things it could be used for, but if you&#8217;ve got Windows 7, try downloading something large in IE8 &#8212; you actually see the progress as a green background on the taskbar button.  I have to investigate whether this means you can owner-draw stuff on the taskbar, or if they&#8217;ve just provided progress bars built-in.  If it&#8217;s the former, you can expect to see lots of cool stuff in the near future (like counts of unread messages or emails, etc).</li>
		<li>Two tiles for the same app appear to be merged together &#8212; That is, if you unstack windows, or choose to stack only when there are too many to fit, the borders between buttons are less visible, and the mouse-over highlight carries across them.  This is most noticeable if you make your taskbar vertical.</li>
	</ol>
	<ol>
		<li>There is coloring of apps, so when you mouse over the taskbar buttons, they get highlighted in a color that is based on their icon.</li>
	</ol>

	<p>OK, there&#8217;s actually more changes than just those &#8230; the desktop wallpaper has a built-in &#8220;slideshow&#8221; feature, so you can have your wallpaper change every day (or every 10 seconds, or something in between).  The <span class="caps">UAC</span> prompts have a link on them to the <span class="caps">UAC</span> preference panel where you can disable <span class="caps">UAC</span> as easy as sliding a slider.  The taskbar can &#8220;learn&#8221; just like the start menu does, to keep the apps you use the most always available&#8230; or you can just pin those apps to the taskbar manually (again, just like the start menu).</p>

	<p>So there&#8217;s lots of cool new features in the shell, even without getting into touch interfaces and other stuff, and generally, I think this represents a bigger change than the windows 95-98 and possibly even bigger than 2000 to XP, and on top of all that, the relative performance of the system seems to go in the right direction for a change.</number></p>

<div class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/ae205315-98ea-49d8-a5b1-4404d00bd5b2/" title="Zemified by Zemanta"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=ae205315-98ea-49d8-a5b1-4404d00bd5b2" alt="Reblog this post [with Zemanta]" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/first-impressions-of-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing a clean Development box</title>
		<link>http://huddledmasses.org/installing-a-clean-development-box/</link>
		<comments>http://huddledmasses.org/installing-a-clean-development-box/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 21:00:56 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[WindowsUpdate]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/installing-a-clean-development-box/</guid>
		<description><![CDATA[The hard drive in my development box died last week, and although I&#8217;ll spare you the story of the replacement process, I thought it might be interesting to document the process of rebuilding my dev box, and provide color commentary while I&#8217;m at it. Install Windows Vista (Business) Get domain admin (my boss) to log [...]]]></description>
			<content:encoded><![CDATA[	<p>The hard drive in my development box died last week, and although I&#8217;ll spare you the story of the replacement process, I thought it might be interesting to document the process of rebuilding my dev box, and provide color commentary while I&#8217;m at it.</p>

	<p>	<ol>
		<li>Install Windows Vista (Business)</li>
		<li>Get domain admin (my boss) to log in and connect my machine to the domain</li>
		<li>Add my domain account as an administrator</li>
		<li>Log out and log back in as my domain accout (it&#8217;s important to do this <span class="caps">ASAP</span> or I end up with shortcuts and things in the &#8216;root&#8217; user account).</li>
		<li>Adjust Windows settings (via &#8220;Programs and Features&#8221;) to include the <a href="http://support.microsoft.com/kb/920201"><span class="caps">IIS</span> Features required</a> for <span class="caps">SQL</span> Reporting services (<a href="http://blogs.msdn.com/bwelcker/archive/2007/03/19/candy-apple-grey-installing-ssrs-and-windows-vista.aspx">*</a>). I had to add the &#8220;Basic Authentication&#8221; to this list, I think, and I changed a few other features while I was in there &#8230; this actually required a reboot for some reason (presumably <em>not</em> because I added minesweeper and solitaire).</li>
		<li>Install Windows PowerShell (in hopes of doing other things faster)</li>
		<li>Create User Account for Sql Server to use</li>
		<li>Install <span class="caps">SQL</span> Server (before Visual Studio, to avoid <span class="caps">SQL</span> Express and the resulting lack of <span class="caps">SQL</span> Manager)</li>
		<li>While waiting for that, slow it down by copying my Projects, Documents, and Pictures folders over from the backup &#8230; I need my PowerShell profile and wallpaper before the defaults drive me insane.</li>
		<li>Change my wallpaper and avatar (that orange flower is actually annoying).</li>
		<li>Install Notepad++ (and copy userDefineLang.xml from backup for PowerShell scripts)
		<li>In order to finder Change Explorer settings to:
	<ol>
		<li>Show Hidden files and folders</li>
		<li><span class="caps">NOT</span> Hide extensions for known file types</li>
		<li>Hide protected operating system files (I leave this, because Vista has tons of hidden junction points (for compatability) in my user directory which are very distracting)</li>
	</ol></li>
	</ol>
	<ol>
		<li>Launch folder windows in a separate process (Explorer still crashes sometimes in Vista)</li>
	</ol></li></p>

	<p>Some side notes:<br />
I&#8217;m actually capable of compiling most of my projects (using MSBuild on the command line) without installing <span class="caps">SQL</span> Server, and the rest of them require third party controls which I will not install until after Visual Studio is installed.  However, having installed <span class="caps">SQL</span> Client, Notepad++ and PowerShell I can actually edit, recompile, and run queries via PowerShell &#8230; so in an emergency, at this point I can start fixing bugs  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' /> </p>

	<p>Windows Vista, <span class="caps">SQL</span> Server, Visual Studio, and MS Office <strong>all</strong> want me to go online and check for service patches as soon as I install them. Since I feel fairly secure sitting behind my firewall, I don&#8217;t bother with this until all of them are installed &#8212; Microsoft Update will find and install all of the service packs in one fell swoop.</p>

	<p><span class="caps">SQL</span> Server and Visual Studio are the only two apps I install which have installers which are so badly behaved that I don&#8217;t even try to install them in my usual sub-folders (C:\Programs\DevTools\ in this case).. <span class="caps">SQL</span> Server, for instance, will make a &#8220;C:\Program Files\Microsoft <span class="caps">SQL</span> Server\&#8221; folder no matter what you tell it during install, and nothing I&#8217;ve found can convince it to do otherwise, so I might as well install to that location, and not end up with multiple confusing folders (I&#8217;ll make junctions in C:\Programs\DevTools\ later to keep myself sane).</p>

	<h4>More Software <span id="more-449"></span></h4>

	<ol>
		<li>Install Visual Studio 2005. This will take a while, so I get a fresh cup of coffee, start writing this post, and start playing with a WordPress plugin.  I guess I could install VS 2008 B2 (people keep saying I should), but the last time we messed with beta development tools here we got bit badly by some changes in the final release that cost us hours of manual grep&#8217;ing&#8230;
	<ol>
		<li>I don&#8217;t bother installing Dotfuscator, Crystal Reports, or <span class="caps">SQL</span> Server express.</li>
		<li>I don&#8217;t generally install Visual J# &#8212; I have never seen a J# app, or even J# sample code, but I do have a couple of tools which require portions of the J# project support for some reason (I&#8217;ll have to come back and make a note here when I remember what they are).</li>
	</ol></li>
	<ol>
		<li>This time I didn&#8217;t install Visual Basic either. VB.net code is relatively rare &#8230; and because of the idiocy of Microsoft in choosing the term &#8220;.net,&#8221; and the abundance of VB6 code &#8230; when I&#8217;m searching for .Net solutions I tend to use &#8220;C#&#8221; as my search term anyway, so I rarely see VB.  On those rare occasions when I need to edit or compile a VB app I tend to edit in Notepad++ or convert it in MonoDevelop&#8230;</li>
	</ol></li>
		<li>Install Visual Source Safe.  I had hoped that by my next install we&#8217;d have switched completely to MS Team Server or to Subversion, but Team Server turns out to cost ridiculous ammounts of money despite our Certified Partner status, and we haven&#8217;t found the time to switch to Subversion since we found that out for sure.</li>
		<li>Try to copy and paste something, and notice <a href="http://www.bluemars.org/clipx/">ClipX</a> is missing.  Install.</li>
		<li>While trying to install ClipX&#8217;s Stickies plugin (requires creating a plugins folder in the ClipX install location, and copying file to that folder) I have to click 6 extra times because of <span class="caps">UAC</span> &#8212; I turn off the secure desktop, but I don&#8217;t want to disable <span class="caps">UAC</span>, so I need to be able to easily run Explorer as root. <a href="http://huddledmasses.org/vista-setuid-how-to-elevate-without-prompting/">PowerShell to the rescue</a> (I am reminded that I never got around to making this script create shortcuts).</li>
		<li>My profile can&#8217;t be loaded because execution of scripts is disabled. Ok, that&#8217;s a <strong>really</strong> annoying default. <code>Set-ExecutionPolicy RemoteSigned</code> but now my profile causes problems because my profile uses PowerShell Community Extensions which I haven&#8217;t installed yet &#8212; I&#8217;ll do that later.</li>
		<li>Now try to use my hotkey to launch Explorer as root, and realize I haven&#8217;t installed <a href="http://www.autohotkey.com/">AutoHotkey</a> yet.  The version I have in my pre-downloaded folder is old, so I go to download the new one, and discover I haven&#8217;t installed Firefox yet.</li>
		<li>Install <a href="http://www.mozilla.com/firefox/">Firefox</a> (for the moment, resist the urge to install extensions)</li>
		<li>Install <a href="http://www.autohotkey.com/">AutoHotkey</a></li>
		<li>Need to look up a serial number. Install <a href="http://keepass.info/">KeePass</a>.  I actually run KeePass from my <span class="caps">USB</span> drive (so that I keep all my passwords current no matter whether I change them while at work or at home), but I keep a backup copy of the key file and software on my main box at work and at home in case some day I loose or forget my <span class="caps">USB</span> drive (that hasn&#8217;t happened since I upgraded to a thumbdrive from a SD card + reader a while back so I could keep it on my keychain &#8212; because I forgot the old one at our other office location all the way across town).
		<li><strong>Try</strong> to install (an old copy of) the Component One controls using that serial number so I can compile the rest of my apps in &#8220;production&#8221; mode (production mode involves preprocessor #if statements to remove dependencies on nUnit/mbUnit).  
	<ol>
		<li>C1&#8217;s installer is a travesty, and I finally resort to typing the number by hand &#8230;
	<ol>
		<li>Three separate boxes for the three parts of the number which are just dash-separated.  </li>
		<li>Pasting the whole number only pastes the first box</li>
	</ol></li>
	<ol>
		<li>Alt-Tab&#8217;ing off to look up the rest of the number sets input focus back onto the &#8220;Organization&#8221; or &#8220;User Name&#8221; input fields if the focus was on one of the serial number boxes.</li>
	</ol></li>
		<li>After all of that, it doesn&#8217;t install. Maybe because it wasn&#8217;t running elevated and can&#8217;t write to &#8220;Program Files&#8221; ... it&#8217;s an .msi file so I can either: run msiexec from an elevated PowerShell window, or install the controls somewhere else.</li>
		<li>These things shouldn&#8217;t come with installers anyway &#8230; it&#8217;s just a bunch of control assemblies.  But it needs to be put in the <span class="caps">GAC</span>, registered with Visual Studio, and who knows what else. I try to install it next to my open source controls in C:\Users\JBennett\Projects\Controls\... but the install still fails. Must be that it needs to be admin to put the controls in the GAC? Very poor installer to fail completely because of something like that. (I&#8217;m starting to get annoyed).</li>
		<li>Run PowerShell, but reencounter the missing Community Extensions.</li>
		<li>Install <a href="http://www.codeplex.com/PowerShellCX">PSCX</a> &#8230; and wonder if there&#8217;s a way to carry PowerShell snapins on a <span class="caps">USB</span> key and not install them&#8230;  one last error remains: missing mow&#8217;s PowerTab &#8230; this one is actually installed in my $ProfileDir/PowerTab, but mow&#8217;s installer hard-coded the profile path, and my new profile path is subtly different. Simple fix.</li>
	</ol></li>
	<ol>
		<li>Finaly succeed in installing ComponentOne controls by running from the Elevated PowerShell console. Turns out installing to the <span class="caps">GAC</span> is optional, so I have no idea why it had to be admin.</li>
	</ol></li>
		<li>Install <a href="http://nunit.com/">nUnit</a> so I can compile my projects in regular debug and release modes. This one goes in C:\Programs\DevTools, it&#8217;s a lot more than just assemblies.</li>
		<li>It&#8217;s high time I ran Windows updates (I need another coffe break). Run &#8220;Updates&#8221; and click the &#8220;get updates for more products.&#8221; Install the Microsoft Update update to Windows Update (wow, that&#8217;s a little mindbending).</li>
		<li>Total: 41 Updates (including one for Microsoft Office, which I haven&#8217;t installed yet, what&#8217;s up with that?)</li>
		<li>2 hours later and one reboot later &#8230; tried to open a solution in Visual Studio and found the Visual Studio 2005 SP1 update for Vista compatability hadn&#8217;t been installed.  Back to Windows updates&#8230;.</li>
	</ol>
	<ol>
		<li>2 Updates: The compatability pack for Visual Studio, and a critical <span class="caps">SQL</span> Server patch.  The only thing that takes longer to install than a Visual Studio patch is a <span class="caps">SQL</span> Server patch.  I finally clicked &#8220;Shut Down and Install Updates&#8221; and went home.</li>
	</ol>

	<h3>Feedback </h3>

	<p><a href="http://www.codeassassin.com/blog/">Jason Stangroome</a> posted a comment suggesting that I shouldn&#8217;t be running my domain account as administrator (I&#8217;m not displaying comments on the page right now, you can read them in the <a href="./feed">feed</a>, and I get emails for each one, and respond to them via email or, when they&#8217;re particularly interesting, by modifying the post). He claims that:</p>

	<blockquote>
		<p>On both XP and Vista for the last two years we have had a basic domain account called “LocalAdmin” added as a local administrator to all dev workstations. We use this to install stuff. Otherwise, our personal domain accounts are just boring users (not even Power Users).</p>
		<p>Visual Studio, <span class="caps">SQL</span> Server, web development and all the usual stuff works fine as non-admin.</p>
	</blockquote>

	<p>More power to you, Jason, if you&#8217;re able to work without being in the administrators group.  </p>

	<p><blockquote><p>Microsoft recommends that when using Visual Studio 2005, you do the following:</p><ul><li>Run Visual Studio with elevated administrator permissions</li><li>Be a member of the "Administrators" group on the local machine</li><li>Right-click the Visual Studio icon and select the "Run as administrator" option from the context menu</li></ul></blockquote></p>

	<p>If you look at <a href="http://msdn2.microsoft.com/en-us/vstudio/aa972193.aspx">this list of known issues</a> which <strong>only</strong> apply to those using Visual Studio 2005 on Vista <em>without</em> being an administrator, I find that several of those affect me. Just the process of <a href="http://msdn2.microsoft.com/en-us/vstudio/aa972193.aspx#question16">debugging web apps in IE</a>  is quite simply unacceptable, even leaving aside all the other problems, like the fact that profilers don&#8217;t work, you can&#8217;t browse web services on your own machine, and the managed code <span class="caps">SDK</span> debugger won&#8217;t let you change options.  When I try to open our current web project in Visual Studio running non-elevated I get this error message:</p>

<pre><code>---------------------------
Microsoft Visual Studio
---------------------------
Unable to read the project file &#39;Home.csproj&#39;. The Web Application Project Home is 
configured to use IIS.To access local IIS Web sites, you must run Visual Studio in 
the context of an administrator account. By default, Windows runs applications in
a limited-privilege user account even when you are logged on to the computer as 
an administrator. To run Visual Studio with administrative privileges, right-click the 
Visual Studio icon and then click &#39;Run as administrator&#39;.
---------------------------
OK   Cancel   Help   
---------------------------
</code></pre>

	<p>Honestly, I&#8217;d also hate having to log in (as that administrator account) each time I wanted to test the installers, or shut off or restart the local <span class="caps">SQL</span> Server (which I don&#8217;t leave running all the time), etc.  It just doesn&#8217;t seem worth it, and with the interaction required to actually elevate things, I don&#8217;t see the danger in being a member of the administrators group.</p>

	<h4>Day Two</h4>

	<p>Technically, this is day three, because day two was spent in various unscheduled meetings, and at home, taking care of sick kids.  That&#8217;s pretty much par for the course in the real world  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' /> .</p>

	<p>So I finally tried to open up and compile my main project, only to find that the &#8220;signtool.exe&#8221; which I use as part of the build process to code-sign the assemblies for click-once deployment is &#8230; missing.  Yep &#8212; it&#8217;s part of the Windows <span class="caps">SDK</span>.  This makes me wince, because, although I clearly need the <span class="caps">SDK</span> in order to sign my apps, I was hoping not to have to install it before I created my &#8220;I can compile&#8221; disk image. I&#8217;m already up to 27GB (and I still haven&#8217;t decided if I should install MS Office).</p>

	<ol>
		<li>Open Firefox and finde that since I downloaded everything from my secondary PC the other day, I never got around to setting the proxy server. Set the proxy server.</li>
		<li>Don&#8217;t forget to tell Firefox that when it starts it should &#8220;Show my windows and tabs from last time.&#8221;</li>
		<li>Spend 10 minutes googling trying to figure out which is the latest Windows <span class="caps">SDK</span>.  What&#8217;s up with that?</li>
		<li>Try to download <a href="http://www.microsoft.com/downloads/details.aspx?familyid=4377f86d-c913-4b5c-b87e-ef72e5b4e065&#38;displaylang=en">Windows SDK</a> (the &#8216;online&#8217; version rather than the <span class="caps">ISO</span>, because I can&#8217;t find an <span class="caps">ISO</span> version of this &#8220;Update&#8221; and the update is really a full version which requires you to <em>manually</em> uninstall the old stuff).</li>
		<li>Forced to install <a href="http://download.microsoft.com/download/5/b/0/5b0d4654-aa20-495c-b89f-c1c34c691085/WGAPluginInstall.exe">WGAPluginInstall.exe</a> in order to proceed.</li>
		<li>Restart Firefox (hmm, I didn&#8217;t think I had to do that last time).</li>
		<li>Finally start downloading the <span class="caps">SDK</span> (had to manually click, because the page got stuck on &#8220;Transferring data from m.webtrends.com&#8221; has anyone else had this problem on the Microsoft sites lately?).</li>
		<li>In extreme frustration (after trying for the 100th time today to mouse across onto my other computer) go and download Synergy (Is the <a href="http://sourceforge.net/project/stats/detail.php?group_id=59275&#38;ugn=synergy2&#38;mode=week&#38;type=tracker">Synergy project dead?</a>).</li>
		<li>Install Synergy, and to my suprise, it still has my configuration.  It must be storing that in my &#8220;Documents&#8221; folder instead of in app settings, because I deliberately didn&#8217;t bring App Settings from the old box.</li>
		<li>Try running synergy, and it dies, because the dev box has a new name now.  </li>
		<li>Restart Synergy and add the new name as an alias &#8230; tell Windows Firewall to unblock Synergy, and we&#8217;re good.</li>
		<li>Notice that the <span class="caps">SDK</span> download is called &#8220;setup.exe&#8221; and I can&#8217;t rename it from within Firefox.  Go and get the <a href="https://addons.mozilla.org/en-US/firefox/addon/26">Download Statusbar</a> extension to fix that.
		<li>Installing <span class="caps">SDK</span>.  
	<ol>
		<li>Don&#8217;t forget to set the samples to install in something like &#8220;C:\Users\JBennett\Projects\<span class="caps">SDK</span> Samples&#8221; because you shouldn&#8217;t be compiling things into &#8220;C:\Program Files&#8221; (plus it requires an elevated compiler).</li>
		<li>Odd that the <span class="caps">SDK</span> shows .Net Compact Framework 2.0 as grayed out, and the comment says &#8220;is not installed by default&#8221; and yet, it&#8217;s checked, and I can&#8217;t uncheck it.</li>
	</ol></li>
	<ol>
		<li>Spend some time wondering if I actually use the Win32 portion of the <span class="caps">SDK</span> any more.  Almost everything I write is in .Net nowadays. (I installed the Win32 stuff anyway, just in case I want to compile <a href="http://www.geoshell.org">GeoShell</a> at work).</li>
	</ol></li>
	</ol>
	<ol>
		<li>Rebooted for the <span class="caps">SDK</span> (I don&#8217;t think it really needs that, but who knows).</li>
	</ol>

	<h4>Yay! I can compile </h4>

	<p>Well, I should say: I can compile my WinForms apps. I have to install a few more things to be able to compile the web and wpf apps, including:</p>

	<ul>
		<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&#38;displaylang=en">Asp.Net AJAX</a>, for the web apps I&#8217;m responsible for &#8212; I also need the <a href="http://www.codeplex.com/AtlasControlToolkit">AjaxControlToolkit</a> but we&#8217;ve had versioning problems with it, so we keep a specific version of it in source control.</li>
		<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=f54f5537-cc86-4bf5-ae44-f5a1e805680d&#38;DisplayLang=en">Visual Studio 2005 extensions for .Net 3.0 for WPF</a>. The <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5d61409e-1fa3-48cf-8023-e8f38e709ba6&#38;DisplayLang=en">Extension for  WWF</a> can wait.</li>
	</ul>
	<ul>
		<li><a href="http://www.getfirebug.com/">Firebug</a> is indispensable. The <a href="http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&#38;displaylang=en">IE Developer Toolbar</a> is slightly less useful, but still important when you need things to work cross-browser.</li>
	</ul>

	<p>Now I can finally compile everything &#8230; but I need to install a few extra tools before I create our image. Several of the apps I personally consider <em>mandatory</em> aren&#8217;t used by other developers on our team &#8230; but these few are needed by everyone:</p>

	<ul>
		<li><a href="http://www.disc-tools.com/download/daemon">Daemon Tools</a>, I would leave out of my image, except it&#8217;s tricky to install it without getting adware, and since this image will be shared by others in our group in the future, I install it.</li>
		<li><a href="http://isorecorder.alexfeinman.com/isorecorder.htm"><span class="caps">ISO</span> Recorder</a> (because I had to burn an <span class="caps">ISO</span> to CD as part of my imaging process, and for some reason my XP box wasn&#8217;t handling that task well).</li>
	</ul>
	<ul>
		<li>If this wasn&#8217;t Vista, I&#8217;d be sure to include the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&#38;displaylang=en">Consolas Font</a> for Visual Studio (it&#8217;s installed on Vista by default).</li>
	</ul>

	<p>I&#8217;ll post a bit about this imaging process tomorrow, assuming all goes well, but in the meantime, here&#8217;s a <em>partial</em> list of my additional software (what I can think of from looking in my download folder from the previous build): <a href="http://www.aisto.com/roeder/dotnet/">Reflector</a>, Virtual PC 2007, <a href="http://filezilla-project.org/">FileZilla</a> (I still use 2.0 at work &#8216;cause I need proxy support), <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=fb7900db-4380-4b0f-bb95-0baec714ee17&#38;DisplayLang=en">Silverlight 1.0</a>, Expression Blend and Expression Web, Paint.Net, TugZip (for 7Zip support), Bitstream Vera fonts, and some Visual Studio plugins: <a href="http://www.roland-weigelt.de/ghostdoc/">GhostDoc</a> and <a href="http://www.paraesthesia.com/blog/comments.php?id=701_0_1_0_C">Documentor</a> (which is an addin for <a href="http://www.devexpress.com/Downloads/NET/IDETools/DXCore/">DXCore</a> and which reminds me that I ought to get CodeRush), <a href="http://www.testdriven.net/">TestDriven</a>, <a href="http://ankhsvn.tigris.org/">AnkhSVN</a>, Project Aggregator, Enterprise Library 3.0, and more.</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/installing-a-clean-development-box/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

