<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Code Assassin &#187; PowerShell</title>
	<atom:link href="http://blog.codeassassin.com/category/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.codeassassin.com</link>
	<description>Silently disposing your objects in the dead of night.</description>
	<lastBuildDate>Sun, 05 Feb 2012 22:30:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.codeassassin.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code Assassin &#187; PowerShell</title>
		<link>http://blog.codeassassin.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.codeassassin.com/osd.xml" title="Code Assassin" />
	<atom:link rel='hub' href='http://blog.codeassassin.com/?pushpress=hub'/>
		<item>
		<title>Create a PowerShell v3 ISE Add-on Tool</title>
		<link>http://blog.codeassassin.com/2012/01/16/create-a-powershell-v3-ise-add-on-tool/</link>
		<comments>http://blog.codeassassin.com/2012/01/16/create-a-powershell-v3-ise-add-on-tool/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 23:38:27 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://jstangroome.wordpress.com/?p=302</guid>
		<description><![CDATA[Note: This process is based on PowerShell v3 CTP 2 and is subject change. When you open PowerShell v3&#8242;s ISE (Integrated Scripting Environment) you should see a new Commands pane that wasn&#8217;t present in version 2. This is a built-in example of an ISE Add-on Tool but you can also create your own quite easily. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=302&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>Note: This process is based on PowerShell v3 CTP 2 and is subject change.</em></p>
<p>When you open PowerShell v3&#8242;s ISE (Integrated Scripting Environment) you should see a new Commands pane that wasn&#8217;t present in version 2.</p>
<p><a href="http://jstangroome.files.wordpress.com/2012/01/commands-pane.png"><img class="alignnone size-full wp-image-303" title="Commands pane" src="http://jstangroome.files.wordpress.com/2012/01/commands-pane.png?w=595" alt=""   /></a></p>
<p>This is a built-in example of an ISE Add-on Tool but you can also create your own quite easily. At its simplest an ISE Add-on Tool is a WPF Control that implements the <a href="http://msdn.microsoft.com/en-us/library/microsoft.powershell.host.ise.iaddontoolhostobject(v=vs.85).aspx">IAddOnToolHostObject </a>interface. To get started writing your own add-on follow these simple steps:</p>
<ol>
<li>Open Visual Studio and create a new WPF User Control Library project. The new project should contain a new UserControl1.</li>
<li>Add a new Project Reference to the Microsoft.PowerShell.GPowerShell (version 3.0) assembly located in the GAC.</li>
<li>Open the UserControl1.xaml.cs code-behind file and change the UserControl1 class to implement the IAddOnToolHostObject interface.</li>
<li>The only member of this interface is the HostObject property which can be declared a a simple auto-property for now.</li>
<li>Build the project and find the path of the DLL it produces.</li>
<li>Open the PowerShell v3 ISE and load the DLL you have just built, eg:<br />
Add-Type -Path &#8216;c:\users\me\documents\project1\bin\debug\project1.dll&#8217;</li>
<li>Add the UserControl to the current PowerShell tab&#8217;s VerticalAddOnTools collection and make it visible (replace &#8220;Project1.UserControl1&#8243; below with the full namespace of your control):<br />
$psISE.CurrentPowerShellTab.VerticalAddOnTools.Add(&#8216;MyAddOnTool&#8217;, [Project1.UserControl1], $true)</li>
</ol>
<p>After following these steps you should see a new, blank pane as an extra tab where the Commands pane normally appears and now you can return to Visual Studio and start adding to the appearance and behaviour of your new add-on tool. There are some other things worth knowing about developing ISE Add-On Tools:</p>
<ul>
<li>When your UserControl is added to the ISE, the HostObject property is set to an object almost identical to the <a href="http://technet.microsoft.com/en-us/library/dd819500.aspx">$psISE</a> variable and your control uses this to interact with the ISE itself. For example you can manipulate text in the editor, or you can register for events that tell your control when a new file is opened.</li>
<li>While your UserControl is loaded in the ISE, you cannot build in Visual Studio because the DLL is locked and you need to close the ISE to unlock the file. I recommend adding a small PowerShell script to your project that performs steps 6 and 7 above and change your project&#8217;s Debug options in Visual Studio so that the ISE is started and your script is opened when you press F5.</li>
<li>In step 7 above, your control is added to the VerticalAddOnTools collection but there is also a HorizontalAddOnTools collection and the user can move your control between these two at any time via the ISE menus so make sure you design the appearance of your Add-On Tool to work in both orientations.</li>
</ul>
<p>Alternatively the <a href="http://showui.codeplex.com/">Show-UI module</a> for PowerShell includes a ConvertTo-ISEAddOn cmdlet to create the necessary WPF objects natively from PowerShell and avoid the need for a Visual Studio project.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/302/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=302&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2012/01/16/create-a-powershell-v3-ise-add-on-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>

		<media:content url="http://jstangroome.files.wordpress.com/2012/01/commands-pane.png" medium="image">
			<media:title type="html">Commands pane</media:title>
		</media:content>
	</item>
		<item>
		<title>Executing individual PowerShell commands using .NET 4</title>
		<link>http://blog.codeassassin.com/2011/03/23/executing-individual-powershell-commands-using-net-4/</link>
		<comments>http://blog.codeassassin.com/2011/03/23/executing-individual-powershell-commands-using-net-4/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 09:34:27 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=255</guid>
		<description><![CDATA[One of the many great things about PowerShell is that it can utilise the .NET framework directly and third party .NET libraries whenever PowerShell doesn&#8217;t offer a native solution. However, the PowerShell console, the Integrated Scripting Environment (ISE) and PS-Remoting in PowerShell 2.0 are all built for use with .NET 2.0 through to .NET 3.5. With [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=255&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the many great things about PowerShell is that it can utilise the .NET framework directly and third party .NET libraries whenever PowerShell doesn&#8217;t offer a native solution. However, the PowerShell console, the Integrated Scripting Environment (ISE) and PS-Remoting in PowerShell 2.0 are all built for use with .NET 2.0 through to .NET 3.5. With the release of version 4 of the .NET Framework though, there is an increasing amount of core functionality and third-party assemblies that are not accessible from PowerShell — the new <a href="http://msdn.microsoft.com/en-us/library/system.environment.is64bitoperatingsystem.aspx">Is64BitOperatingSystem property</a> on the System.Environment class is a simple example.</p>
<p>So, given that .NET 4 has excellent support for being able to run most .NET 2 assemblies but PowerShell doesn&#8217;t have officially support for .NET 4 yet, how can we safely utilise new .NET 4 functionality from PowerShell without waiting for a new PowerShell release from Microsoft? A quick search of the web will reveal a few different approaches, each with their own major drawbacks:</p>
<ul>
<li>Change the system-wide registry setting to load all .NET 2 assemblies under .NET 4 instead for all .NET applications.</li>
<li>Change the system-wide config files for the PowerShell console, ISE, and Remoting service to use .NET 4 instead for all PowerShell sessions.</li>
<li>Build a small .NET 4 application to host a PowerShell Runspace in-process as .NET 4.</li>
</ul>
<p>These options are either have too wide an effect or vary too much from the standard PowerShell experience for me to adopt. What if there was a way, from inside a standard PowerShell 2 session to execute a single command, script block, or script under .NET 4 without touching any upfront configuration, without requiring elevated permissions, and without affecting anything else on the system?</p>
<p>This solution is available in the form of the new <a href="http://msdn.microsoft.com/en-us/library/ff361644.aspx">Activation Configuration Files</a> feature also introduced in .NET Framework 4.0. By dynamically creating a small config file in a temporary directory then setting a process-scoped environment variable we can easily start a new .NET 4 PowerShell session passing in a ScriptBlock and some arguments and receive the same deserialized objects in return as you would see when using Remoting.</p>
<p>I&#8217;ve implemented my first version of this technique as <a href="https://gist.github.com/882528">a PowerShell script module available on Gist.GitHub</a>. It includes an Invoke-CLR4PowerShellCommand Cmdlet which behaves just like a very simple version of the built-in Invoke-Command Cmdlet. The module also includes a Test-CLR4PowerShell function demonstrating basic use of the module.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/255/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=255&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2011/03/23/executing-individual-powershell-commands-using-net-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Query all file references in a Visual Studio solution with PowerShell</title>
		<link>http://blog.codeassassin.com/2010/08/30/query-all-file-references-in-a-visual-studio-solution-with-powershell/</link>
		<comments>http://blog.codeassassin.com/2010/08/30/query-all-file-references-in-a-visual-studio-solution-with-powershell/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 09:52:06 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=231</guid>
		<description><![CDATA[Today I was working on introducing Continuous Integration to a legacy code base and was discovering the hard way that the solution of about 20 projects had many conflicting references to external assemblies. Some assemblies were different versions, others the same version but in different paths, and others completely missing altogether. Needless to say this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=231&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I was working on introducing Continuous Integration to a legacy code base and was discovering the hard way that the solution of about 20 projects had many conflicting references to external assemblies. Some assemblies were different versions, others the same version but in different paths, and others completely missing altogether. Needless to say this wasn&#8217;t going to build cleanly on a build server.</p>
<p>Rather than manually checking the path and version of every assembly referenced by every project in the solution, I wrote a PowerShell script to parse a Visual Studio 2010 solution file, identify all the projects, then parse the project files for the reference information. The resulting <a href="http://gist.github.com/557222">Get-VSSolutionReferences.ps1 script is available on GitHub</a>.</p>
<p>Once I had a collection of objects representing all the assembly references I could perform some interesting analysis. Here is a really basic example of how to list all the assemblies referenced by two or more projects:</p>
<pre>$Refs = &amp; .\Get-VSSolutionReferences.ps1 MySolution.sln
$Refs | group Name | ? { $_.Count -ge 2 }</pre>
<p>It doesn&#8217;t take much more to find version mismatches or files that don&#8217;t exist at the specified paths, but I&#8217;ll leave that as an exercise for you, the reader.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>, <a href='http://blog.codeassassin.com/category/visual-studio/'>Visual Studio</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/231/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=231&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/08/30/query-all-file-references-in-a-visual-studio-solution-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Import a Gist into your PowerShell ISE profile</title>
		<link>http://blog.codeassassin.com/2010/08/12/import-a-gist-into-your-powershell-ise-profile/</link>
		<comments>http://blog.codeassassin.com/2010/08/12/import-a-gist-into-your-powershell-ise-profile/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 15:12:38 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=222</guid>
		<description><![CDATA[I realised a few hours after posting my last entry about a PowerShell ISE profile script, that I failed to describe to people new to the ISE environment, how to include the script as part of their ISE profile so it is always available. Simply explaining how to determine the path of your ISE profile [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=222&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I realised a few hours after posting <a href="http://blog.codeassassin.com/2010/08/11/automatic-tfs-check-out-for-powershell-ise/">my last entry</a> about a PowerShell ISE profile script, that I failed to describe to people new to the ISE environment, how to include the script as part of their ISE profile so it is always available.</p>
<p>Simply explaining how to determine the path of your ISE profile by checking the value of the $Profile variable from within the ISE would be boring, so instead I wrote another script to automatically download the first script from <a href="https://github.com/">GitHub</a>, and add it to your profile.</p>
<p>This <a href="http://gist.github.com/519103">new script</a> can simply be copied and pasted into the ISE&#8217;s Command Pane (Ctrl+D) and your profile will be opened and updated, ready to be saved. Once saved, you can either restart the ISE or simply run &#8221; . $profile &#8221; (without quotes) from the Command Pane.</p>
<p>You will hopefully notice in this new script, that my usual attention to neatness and verbosity has been replaced with terseness due to the purpose of this script being a use once and throw away item. I had considered writing it as a single line but quickly regained my senses.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/222/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/222/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/222/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=222&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/08/12/import-a-gist-into-your-powershell-ise-profile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Automatic TFS Check Out for PowerShell ISE</title>
		<link>http://blog.codeassassin.com/2010/08/11/automatic-tfs-check-out-for-powershell-ise/</link>
		<comments>http://blog.codeassassin.com/2010/08/11/automatic-tfs-check-out-for-powershell-ise/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 08:13:56 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=216</guid>
		<description><![CDATA[I work with a lot of PowerShell scripts, it&#8217;s the fun part of my job. I do most of my editing using the PowerShell ISE, primarily because it is the default, but also because it has great syntax highlighting, tab completion, and debug support. Additionally, all of my scripts are in source control: sometimes Mercurial, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=216&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I work with a lot of PowerShell scripts, it&#8217;s the fun part of my job. I do most of my editing using the <a href="http://technet.microsoft.com/en-us/library/dd315244.aspx">PowerShell ISE</a>, primarily because it is <a href="http://www.useit.com/alertbox/defaults.html">the default</a>, but also because it has great syntax highlighting, tab completion, and debug support. Additionally, all of my scripts are in source control: sometimes <a href="http://mercurial.selenic.com/">Mercurial</a>, occasionally <a href="http://git-scm.com/">Git</a>, but mostly <a href="http://msdn.microsoft.com/en-us/vstudio/ff637362.aspx">Team Foundation Server</a> (TFS).</p>
<p>The way TFS works though, is that all files in your local workspace are marked as read-only until you Check-Out for editing. When working on TFS-managed files in Visual Studio, the check-out is done automatically as soon as you begin typing in the editor. The PowerShell ISE however has no idea about TFS and will let you edit to your heart&#8217;s content until you eventually try to save your changes and it fails due to the read-only flag.</p>
<p>But I&#8217;ve developed a solution&#8230;</p>
<p>I&#8217;ve written a <a href="http://gist.github.com/518638">PowerShell ISE-specific profile script</a> that performs a few simple things:</p>
<ol>
<li>Checks if you have the TFS client installed (eg Team Explorer).</li>
<li>Registers for ISE events on each open file and any files you open later.</li>
<li>Upon editing of a file, if it is TFS-managed then checks it out.</li>
</ol>
<p>The end result is the same TFS workflow experience from within the PowerShell ISE as Visual Studio provides.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>, <a href='http://blog.codeassassin.com/category/tfs/'>TFS</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=216&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/08/11/automatic-tfs-check-out-for-powershell-ise/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Create SCVMM Templates with PowerShell</title>
		<link>http://blog.codeassassin.com/2010/08/03/create-scvmm-templates-with-powershell/</link>
		<comments>http://blog.codeassassin.com/2010/08/03/create-scvmm-templates-with-powershell/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 12:32:06 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SCVMM]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=207</guid>
		<description><![CDATA[Now that I get to work with a TFS 2010 Lab Management environment most days, I find myself building various virtual machines to replicate the  production environments of our clients for testing. With many different clients and projects, the range of virtual machine operating systems expands exponentially as matrix of core OS version, processor architecture, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=207&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Now that I get to work with a TFS 2010 Lab Management environment most days, I find myself building various virtual machines to replicate the  production environments of our clients for testing. With many different clients and projects, the range of virtual machine operating systems expands exponentially as matrix of core OS version, processor architecture, service pack, IE version, and other minor variations. However, for any particular configuration, I&#8217;ll also want multiple copies so naturally I want to make use of System Center Virtual Machine Manager&#8217;s VM Template Library.</p>
<p>However, creating a template from a VM using the SCVMM Administrator Console, without destroying the original VM, is death by a thousand clicks:</p>
<ol>
<li>Shutdown the VM.</li>
<li>Dismount any media in the VM&#8217;s virtual DVD drives.</li>
<li>Clone the VM via an eight-page wizard.</li>
<li>Wait for the cloning to complete.</li>
<li>Convert the cloned VM into a template with a six-page wizard.</li>
<li>Wait for the sysprepping to complete.</li>
<li>Restart the original VM.</li>
</ol>
<p>I tire of such tedium very quickly and as such, I&#8217;ve scripted the above process with PowerShell and the SCVMM Snapin. You can access the <a href="http://gist.github.com/506252">Export-VMTemplate script</a> I&#8217;ve written on gist.github. If you open a PowerShell window from the toolbar in the SCVMM console, you can execute the script like this:</p>
<pre>.\Export-VMTemplate.ps1 -VM 'MyOriginalVm' -TemplateName 'NewTemplateName' -LibraryServer 'MyLibSvr'</pre>
<p>Hopefully the script itself, or at least some of the concepts within, will be useful to someone else.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>, <a href='http://blog.codeassassin.com/category/scvmm/'>SCVMM</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=207&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/08/03/create-scvmm-templates-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Export all report definitions for a Team Project Collection</title>
		<link>http://blog.codeassassin.com/2010/07/22/export-all-report-definitions-for-a-team-project-collection/</link>
		<comments>http://blog.codeassassin.com/2010/07/22/export-all-report-definitions-for-a-team-project-collection/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 08:05:41 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[TFS]]></category>

		<guid isPermaLink="false">http://blog.codeassassin.com/?p=201</guid>
		<description><![CDATA[Team Foundation Server 2010 introduced Team Project Collections for organising Team Projects into groups. Collections also provide a self-contained unit for moving Team Projects between servers and this is well documented and supported. However, if you&#8217;ve ever tried moving a Team Project Collection you&#8217;ll find the documentation is a long list of manual steps, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=201&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Team Foundation Server 2010 introduced Team Project Collections for organising Team Projects into groups. Collections also provide a self-contained unit for moving Team Projects between servers and this is <a href="http://msdn.microsoft.com/en-us/library/dd936138.aspx">well documented and supported</a>.</p>
<p>However, if you&#8217;ve ever tried moving a Team Project Collection you&#8217;ll find the documentation is a long list of manual steps, and one of the more tedious steps is <a href="http://msdn.microsoft.com/en-us/library/dd936138.aspx#SaveReports">Savings Reports</a>. This step basically tells you to use the Report Manager web interface to manually save every report for every Team Project in the collection as an .RDL file. A single project based on the MSF for Agile template will contain 15 reports across 5 folders, so you can easily spend a while clicking away in your browser.</p>
<p>To alleviate the pain, I&#8217;ve written a PowerShell script which accepts two parameters. The first is the url for the Team Project Collection, and the second is the destination path to save the .RDL files to. The script will query the Team Project Collection for its Report Server url and list of Team Projects via the TFS API, then it will use the Report Server web services to download the report definitions to the destination, maintaining the folder hierarchy and time stamps. You can access this script, called Export-TfsCollectionReports, <a href="http://gist.github.com/485519">on Gist</a>.</p>
<p>Obviously, when you reach <a href="http://msdn.microsoft.com/en-us/library/dd936138.aspx#Reports">the step to import the report definitions</a> on the new server, you&#8217;ll want a similar script to help. Unfortunately, I haven&#8217;t written that one yet but I will post it to my blog when I do. In the mean time you could follow the same concepts used in the export script to write one yourself.</p>
<br />Filed under: <a href='http://blog.codeassassin.com/category/powershell/'>PowerShell</a>, <a href='http://blog.codeassassin.com/category/sql-server/'>SQL Server</a>, <a href='http://blog.codeassassin.com/category/tfs/'>TFS</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=201&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2010/07/22/export-all-report-definitions-for-a-team-project-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>No Web Browser, Need PowerShell</title>
		<link>http://blog.codeassassin.com/2009/12/10/no-web-browser-need-powershell/</link>
		<comments>http://blog.codeassassin.com/2009/12/10/no-web-browser-need-powershell/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 07:48:23 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://jstangroome.wordpress.com/?p=13</guid>
		<description><![CDATA[I recently found myself on a Windows Server 2003 machine without a functioning web browser and PowerShell wasn’t installed either. No problem, I just opened notepad and started typing: echo class Program { public static void Main() { &#62;"%~dpn0.cs" echo using (var wc = new System.Net.WebClient()) { &#62;&#62;"%~dpn0.cs" echo wc.UseDefaultCredentials = true; &#62;&#62;"%~dpn0.cs" echo wc.DownloadFile(@"http://download.microsoft.com/download/1/1/7/117FB25C-BB2D-41E1-B01E-0FEB0BC72C30/WindowsServer2003-KB968930-x86-ENG.exe", [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=13&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently found myself on a Windows Server 2003 machine without a functioning web browser and PowerShell wasn’t installed either.</p>
<p>No problem, I just opened notepad and started typing:</p>
<pre>echo class Program { public static void Main() { &gt;"%~dpn0.cs"
echo using (var wc = new System.Net.WebClient()) { &gt;&gt;"%~dpn0.cs"
echo wc.UseDefaultCredentials = true; &gt;&gt;"%~dpn0.cs"
echo wc.DownloadFile(@"http://download.microsoft.com/download/1/1/7/117FB25C-BB2D-41E1-B01E-0FEB0BC72C30/WindowsServer2003-KB968930-x86-ENG.exe", @"%~dpn0.installer.exe");}}} &gt;&gt;"%~dpn0.cs"
"%systemroot%\microsoft.net\framework\v3.5\csc.exe" /out:"%~dpn0.exe" "%~dpn0.cs"
"%~dpn0.exe"
"%~dpn0.installer.exe"</pre>
<p>Saved it as a command script and double-clicked it. PowerShell v2 installer downloads and runs, bam!</p>
<p>This would require tweaking for other processor architectures, other operating system versions, or older .NET installations.</p>
<p>Thanks to <a href="http://twitter.com/tathamoddie">@tathamoddie</a> for the proxy-friendly fix.</p>
<br />Posted in PowerShell  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=13&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2009/12/10/no-web-browser-need-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>Generic batch file wrapper for PowerShell scripts</title>
		<link>http://blog.codeassassin.com/2009/07/14/generic-batch-file-wrapper-for-powershell-scripts/</link>
		<comments>http://blog.codeassassin.com/2009/07/14/generic-batch-file-wrapper-for-powershell-scripts/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 06:22:08 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://jstangroome.wordpress.com/?p=14</guid>
		<description><![CDATA[Integrating PowerShell scripts into older style processes that are only designed to call out to executables or batch files (or “command scripts” as they have been known since NT4) can be slightly messy primarily due to the argument parsing semantics around double-quotes and file paths with spaces. I often end up writing a simple command [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=14&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Integrating PowerShell scripts into older style processes that are only designed to call out to executables or batch files (or “command scripts” as they have been known since NT4) can be slightly messy primarily due to the argument parsing semantics around double-quotes and file paths with spaces. I often end up writing a simple command script to wrap each PowerShell script to simplify this but it is tedious and repetitive and I’ve finally decided to create a generic script that works for any PowerShell script.</p>
<p>Simply save the following code as a text file and save it with the same name as your PowerShell script but replace the .ps1 extension with a .cmd extension.</p>
<pre>@echo off
setlocal
set tempscript=%temp%\%~n0.%random%.ps1
echo $ErrorActionPreference="Stop" &gt;"%tempscript%"
echo ^&amp; "%~dpn0.ps1" %* &gt;&gt;"%tempscript%"
powershell.exe -command "&amp; \"%tempscript%\""
set errlvl=%ERRORLEVEL%
del "%tempscript%"
exit /b %errlvl%</pre>
<p>Now if your script is called “Get-Something.ps1”, you can simply run it like this:</p>
<pre>Get-Something “c:\some path\some.file” –SecondArg 3.14</pre>
<br />Posted in PowerShell  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=14&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2009/07/14/generic-batch-file-wrapper-for-powershell-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
		<item>
		<title>PowerShell for Developers</title>
		<link>http://blog.codeassassin.com/2009/05/20/powershell-for-developers/</link>
		<comments>http://blog.codeassassin.com/2009/05/20/powershell-for-developers/#comments</comments>
		<pubDate>Wed, 20 May 2009 05:41:30 +0000</pubDate>
		<dc:creator>Jason Stangroome</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://jstangroome.wordpress.com/?p=15</guid>
		<description><![CDATA[Several weeks ago Richard Banks (@rbanks54) coerced me to find time to present to the Australian Virtual Alt.NET User Group between moving house and deploying a new website to production for my current client. I agreed and with an absurdly short amount of preparation presented to a small group online using Microsoft Live Meeting and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=15&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Several weeks ago <a href="http://richardsbraindump.blogspot.com/">Richard Banks</a> (<a href="http://twitter.com/rbanks54">@rbanks54</a>) coerced me to find time to present to the Australian Virtual Alt.NET User Group between moving house and deploying a new website to production for my current client.</p>
<p>I agreed and with an absurdly short amount of preparation presented to a small group online using Microsoft Live Meeting and a shared PowerShell console window. You can <a href="http://ozalt.net/blog/virtual-alt-net-11-may-09-powershell-and-ngourd/">watch the presentation</a> on the <a href="http://ozalt.net/blog/">Oz Alt.NET Community Blog</a>.</p>
<p>The “slides” and example scripts can be <a href="http://dl.getdropbox.com/u/255217/OzVAN-PowerShell.zip">downloaded here</a>.</p>
<br />Posted in PowerShell  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jstangroome.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jstangroome.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jstangroome.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jstangroome.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jstangroome.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jstangroome.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jstangroome.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jstangroome.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jstangroome.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jstangroome.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jstangroome.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jstangroome.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jstangroome.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jstangroome.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.codeassassin.com&amp;blog=14026816&amp;post=15&amp;subd=jstangroome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.codeassassin.com/2009/05/20/powershell-for-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/554543093ea89b6bbc287fceac168c3b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">jstangroome</media:title>
		</media:content>
	</item>
	</channel>
</rss>
