<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:media="http://search.yahoo.com/mrss/" version="2.0">

<channel>
	<title>Poshoholic</title>
	
	<link>http://poshoholic.com</link>
	<description>Totally addicted to PowerShell</description>
	<lastBuildDate>Thu, 24 Sep 2009 17:48:20 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain="poshoholic.com" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
<image>
		<url>http://www.gravatar.com/blavatar/39e81c89b01efbd96b0f3f2df6e23019?s=96&amp;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Poshoholic</title>
		<link>http://poshoholic.com</link>
	</image>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Poshoholic" type="application/rss+xml" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">Poshoholic</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>PowerShell 3.0: Why wait? Importing typed objects with typed properties from a CSV file</title>
		<link>http://poshoholic.com/2009/09/18/powershell-3-0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/</link>
		<comments>http://poshoholic.com/2009/09/18/powershell-3-0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 14:48:06 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell 3.0]]></category>
		<category><![CDATA[Import-Csv]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[Proxy function]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/09/18/powershell-3-0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/</guid>
		<description><![CDATA[After working exclusively with PowerShell in my career for over two years now, it has become quite clear to me that the single most valuable feature in Microsoft Windows PowerShell, in my opinion anyway, is its extensibility.&#160; In particular, it’s how easily it can be extended in PowerShell itself through a combination of PowerShell scripts [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=275&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After working exclusively with PowerShell in my career for over two years now, it has become quite clear to me that the single most valuable feature in Microsoft Windows PowerShell, in my opinion anyway, is its extensibility.&#160; In particular, it’s how easily it can be extended in PowerShell itself through a combination of PowerShell scripts and XML files, without the need of a compiler.&#160; There are some features that are a very close second to that (consistency and discoverability), but the extensibility that PowerShell provides is truly second to none.</p>
<p>Version 1.0 of PowerShell was extendible from within PowerShell via combinations of PowerShell functions, the .NET Framework, WMI, ADSI, Add-Member and external ps1xml files that define type extensions and formats, not to mention snapins.&#160; Using these features in PowerShell 1.0, I found them more than capable to allow me to create some really creative workarounds to some challenging issues that were identified in that version.&#160; Not everything can be worked around, of course; some bugs can really only be fixed by the PowerShell team, and that will always be the case.&#160; Those bugs aside though, PowerShell 1.0 really did a great job of providing a ton of functionality and enabling people like you and me to add even more.</p>
<p>Still, the solutions I could come up with in PowerShell 1.0 didn’t function quite the same as a regular PowerShell cmdlet.&#160; There were some subtle differences and limitations in what you could do in that release.&#160; Version 2.0 of PowerShell addresses some of those limitations, bringing even more extendibility options to the table with advanced functions, classes (using Add-Type), modules, and proxy functions.&#160; These new options are a welcome addition to the PowerShell ecosystem and they allow me to ask the question “Why wait for PowerShell 3.0?”, a question I can now try to answer with creative solutions to problems in PowerShell and with creative ways to extend PowerShell so that you don’t necessarily have to wait for the next release to get new features or functionality that you might be looking for.&#160; This article is the first in what I hope becomes a series of solutions that allow you to get some functionality you might find in PowerShell 3.0 without having to wait for it.</p>
<p>First on my list of areas needing improvement comes from a recent question that came up on a mailing list I follow: </p>
<blockquote><p>I&#8217;m using Import-CSV to import a two-&quot;column&quot; CSV file and return a custom object with two additional properties. But I want the first property to be an Int and the second to be a DateTime. How do I do that? (I&#8217;ve tried several strategies, including explicit casting of the types in an array, but they come out as strings.</p>
</blockquote>
<p>Import-Csv is a really, really handy cmdlet.&#160; It allows you to import the contents of a csv (character-separated value) file as a collection of objects so that you can then do things with them.&#160; It is commonly used in bulk provisioning or modification scenarios, where administrators can work with the data in the csv first if necessary and then write a script to do the required work according to the data from each entry in the csv file.</p>
<p>It has certain limitations, though, and those limitations can cause you to have to include additional complexity in your scripts to work around the limitations.&#160; When you import data using Import-Csv, every property on the objects that are created are all of type string.&#160; If you are trying to work with some properties containing dates (System.Datetime) or others containing numeric values or other types, complicated pipelines with manual conversion using ForEach-Object or Select-Object is required.&#160; That’s fine for one-off scenarios, but this has come up before, and it makes sense for Import-Csv to allow users to set the types for the properties on the objects they are importing &#8212; that’s one problem to solve.</p>
<p>Another limitation is that objects imported from Import-Csv don’t necessarily have an appropriate type name associated with them.&#160; If the file was created manually or by another program, the objects will be generic PSObjects.&#160; If the file was created by exporting data from PowerShell using Export-Csv, a type may be included in the csv file but most csv files I work with come from sources other than PowerShell.&#160; You can customize the object type name however you like (and this is recommended if you are doing something like Importing data from a csv file into the <a title="PowerGUI" href="http://powergui.org" target="_blank">PowerGUI</a> Admin Console so that you can then associate relevant actions with that object type), but again this isn’t something you would want to do each time you import csv data because it’s just that much more work.</p>
<p>It sounds to me like this user would have preferred being able to call Import-Csv using a syntax something like this:</p>
<pre><span style="color:#5f9ea0;font-weight:bold;">Import-Csv</span><span style="color:#000000;"> </span><span style="color:#800000;">C:\birthdays.csv</span><span style="color:#000000;"> -Type String,Int,Date</span></pre>
<p>or, with a slightly more powerful example, perhaps like this: </p>
<pre><span style="color:#5f9ea0;font-weight:bold;">Import-Csv</span><span style="color:#000000;"> </span><span style="color:#800000;">C:\birthdays.csv</span><span style="color:#000000;"> -TypeMap @{Age</span><span style="color:#ff0000;">=</span><span style="color:#800000;">'</span><span style="color:#800000;">Int</span><span style="color:#800000;">'</span><span style="color:#000000;">;Birthday=[</span><span style="color:#008080;">System.DateTime</span><span style="color:#000000;">]} </span><span style="color:#800000;">-As</span><span style="color:#000000;"> </span><span style="color:#800000;">'</span><span style="color:#800000;">BirthdayRecord</span><span style="color:#800000;">'</span><span style="color:#000000;"> -UseETS -Overwrite</span></pre>
<p>We could simply put in a feature request to the <a title="PowerShell Connect site" href="https://connect.microsoft.com/PowerShell" target="_blank">PowerShell Connect site</a> (something I recommend you do whenever you come across something you feel is missing or incorrect), but that won’t do anything to help us today.&#160; How can we solve those two problems now and bring Import-Csv into a level of functionality we might like to think we’ll get in PowerShell 3.0, like what is shown above, in such a way that getting typed objects with properly typed properties is as simple as importing data from a csv file using nothing but an Import-Csv command?&#160; The answer to that comes from one of my new best friends in PowerShell: proxy functions.&#160; The proxy function feature in PowerShell allows you to create an advanced function with the same name as a cmdlet that internally calls that cmdlet.&#160; Since functions have a higher precedence that cmdlets in the command precedence order, you’ll always get the proxy function if it’s loaded when you are using the basic (that is to say, non-qualified) cmdlet name.</p>
<p>Creating a proxy function is easy.&#160; All you have to do is execute a static .NET method called Create on the System.Management.Automation.ProxyCommand class and pass in a new System.Management.Automation.CommandMetaData object created by using the result of calling Get-Command for the cmdlet you want to proxy to get the internal script that will be the body of the proxy function, then wrap that in a function with the same name as the cmdlet you are proxying and then, to add that function to your current script file, output it to another file and then copy it over using an editor.&#160; Huh?&#160; That sure sounds complicated.&#160; Well, since it’s not all wrapped up in a cmdlet for you, it is more complicated than it needs to be.</p>
<p>Let’s try that again.</p>
<p>Creating a proxy function is easy.&#160; All you have to do is follow a few steps to get the command you need to run that generates the proxy function body, and then work within your favorite editor to copy that command body into your function in the file you are working on.&#160; My favorite editor is <a title="PowerGUI" href="http://powergui.org" target="_blank">PowerGUI</a>, so I’ll use that in my example.&#160; First, make sure you have installed <a title="PowerGUI" href="http://powergui.org" target="_blank">PowerGUI</a> with the <a title="PowerShell 2.0 snippets" href="http://www.powergui.org/entry.jspa?externalID=2472&amp;categoryID=299" target="_blank">new PowerShell 2.0 snippets</a> (you can read more about those <a title="What&#39;s new in PowerShell 2.0?" href="http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/" target="_blank">here</a>) and then open up your <a title="PowerGUI" href="http://powergui.org" target="_blank">PowerGUI</a> Script Editor and follow these steps:</p>
<ol>
<li>Select Edit | Insert Snippet. </li>
<li>Scroll down the list of snippets until you find a folder called “PowerShell v2” and double-click on it. </li>
<li>Scroll down the list of PowerShell v2 snippets until you find one called “function (proxy)” and double-click on it to insert that snippet. </li>
<li>In the snippet Name field, type in the name of the cmdlet you want to create a proxy for and hit enter. </li>
</ol>
<p>If you like to learn by watching others, you can watch a demonstration of this (and other snippets) in a screencast that is posted on <a title="What&#39;s new in PowerShell 2.0?" href="http://www.youtube.com/watch?v=0EWnfrUqTpE" target="_blank">YouTube</a>.&#160; If you’re a keep-your-fingers-on-the-keyboard junkie like me, you can use shortcuts and type in the snippet folder and name and get this done very quickly.&#160; When you’re done, you’ll have a function that looks something like this:</p>
<pre><span style="color:#008000;">&lt;#</span><span style="color:#008000;">
    For more information about proxy functions, see the following article on the
    Microsoft PowerShell Team blog:

        http://blogs.msdn.com/powershell/archive/2009/01/04/extending-and-or-modifing-commands-with-proxies.aspx
</span><span style="color:#008000;">#&gt;</span><span style="color:#000000;">

</span><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Import-Csv</span><span style="color:#000000;"> {
    </span><span style="color:#008000;">&lt;#</span><span style="color:#008000;">
        To create a proxy function for the Import-Csv cmdlet, paste the results of the following command into the body of this function and then remove this comment:
        [Management.Automation.ProxyCommand]::Create((New-Object Management.Automation.CommandMetaData (Get-Command Import-Csv)))
    </span><span style="color:#008000;">#&gt;</span><span style="color:#000000;">
}</span></pre>
<p>That’s not exactly a proxy function yet.&#160; There’s one more step you need to take, as described in the comment inside the proxy function.&#160; That comment indicates you need to run the command inside it and paste the results of that command over the comment itself.&#160; Copy the command as described in that comment and paste it in the embedded PowerShell Console window that is docked in your <a title="PowerGUI" href="http://powergui.org" target="_blank">PowerGUI</a> Script Editor, and once you have it pasted there, run it by pressing enter.&#160; The result of that command is string output that will become the main body of your proxy function.&#160; If you did this for Import-Csv like I did, it will look like this:</p>
<pre><span>
[CmdletBinding(DefaultParameterSetName='Delimiter')]
param(
    [Parameter(ParameterSetName='Delimiter', Position=1)]
    [ValidateNotNull()]
    [System.Char]
    ${Delimiter},

    [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
    [Alias('PSPath')]
    [System.String[]]
    ${Path},

    [Parameter(ParameterSetName='UseCulture', Mandatory=$true)]
    [ValidateNotNull()]
    [Switch]
    ${UseCulture},

    [ValidateNotNullOrEmpty()]
    [System.String[]]
    ${Header})

begin
{
    try {
        $outBuffer = $null
        if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer))
        {
            $PSBoundParameters['OutBuffer'] = 1
        }
        $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Import-Csv', [System.Management.Automation.CommandTypes]::Cmdlet)
        $scriptCmd = {&amp; $wrappedCmd @PSBoundParameters }
        $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin)
        $steppablePipeline.Begin($PSCmdlet)
    } catch {
        throw
    }
}

process
{
    try {
        $steppablePipeline.Process($_)
    } catch {
        throw
    }
}

end
{
    try {
        $steppablePipeline.End()
    } catch {
        throw
    }
}
&lt;#

.ForwardHelpTargetName Import-Csv
.ForwardHelpCategory Cmdlet

#&gt;</span></pre>
<p>Select all of that text that was output in your docked PowerShell Console window and copy it to your clipboard.&#160; Then paste it over the original comment that told you to do this.&#160; Now you have a proxy function.&#160; It doesn’t do anything different than the cmdlet you are proxying yet, but when it is loaded in your PowerShell session it will proxy that cmdlet properly.</p>
<p>So now you might be saying to yourself: “That’s great (although the process could be a little more streamlined…), but now what do I do?”.&#160; Now you can add your own parameters that you wish were on the original cmdlet in the first place, making the proxy function much more powerful.&#160; For our example with Import-Csv that I showed earlier, I would like to be able to specify the type of the properties in the csv file, either as an array when I want to specify all property types or as a hash table when I only want to specify a type for a few named properties, knowing that the rest will default to string.&#160; I’ll accomplish that by adding a Type and a TypeMap parameter to my Import-Csv proxy function.&#160; I’d also like to be able to specify the type of the object that is imported using Import-Csv, and I’d like to be able to define whether my type name should be treated as an Extended Type Name extension as well as whether or not the current type hierarchy should be overwritten or not.&#160; I’ll accomplish that by adding As, UseExtendedTypeSystem (alias UseETS), and OverwriteTypeHierarchy parameters.</p>
<p>Those changes will allow me to use the syntax I proposed above without waiting for someone else to give it to me.&#160; By taking the time to create the proxy function that supports these parameters I’ll save myself and others time and complexity in the scripts they write by moving all of the extra pipeline complexity that would otherwise be necessary directly inside the proxy function.&#160; It is worth noting that a proxy command isn’t as efficient as it would be if the added functionality were included in the cmdlet itself, but that’s not the point.&#160; The point is that you can extend cmdlets when they leave you wanting more today rather than waiting to see if PowerShell 3.0 includes the extensions you want or not tomorrow (or three years from now, who knows when it will be released).</p>
<p>The resulting proxy function is a pretty good sized function, but we’ve added quite a few features to it as well, and those features need to have some logic to support them.&#160; I’m including my version of the Import-Csv proxy function at the bottom of this post in its entirety so that you can give it a try yourself and see if it helps you out.&#160; With the exception of the parameter definitions I added to the param statement, all logic supporting the new parameters I have added is enclosed in collapsible regions so that you can see the specific locations where I inserted my logic.&#160; That should make it a little easier for you to see how logic can be added within a proxy function, enabling you to experiment a little and create your own PowerShell 3.0 flavors of your favorite cmdlets.&#160; If you prefer to download the ps1 file containing the proxy command directly, I have also shared that on my SkyDrive, <a title="Import-Csv.ps1" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Import-Csv.ps1" target="_blank">here</a>.</p>
<p>There are several other important things I should mention about proxy functions, as follows:</p>
<ol>
<li>You can add parameters, modify parameters, remove parameters, or leave parameters unchanged in proxy functions. </li>
<li>If you add parameters, you need to remove them from the parameter collection ($PSBoundParameters) before you create your wrapped command so that those parameters are not passed to the cmdlet you are proxying.&#160; You may also have to do this if you modify parameters, depending on the modifications you make. </li>
<li>If you find you are adding pipelines to certain commands you call on a regular basis, it is likely a sign that the cmdlet itself needs improvement.&#160; Consider creating proxy functions in these situations so that you don’t have to do as much typing in the long run. </li>
<li>If you create and use proxy functions, share them with the community so that the PowerShell team can see where cmdlets could be improved.&#160; You can’t influence what goes in PowerShell 3.0 if you’re not sharing. </li>
</ol>
<p>Here’s the final version of my Import-Csv proxy function:</p>
<pre><span style="color:#008000;">#</span><span style="color:#008000;">Requires -Version 2.0</span><span style="color:#008000;">
</span><span style="color:#000000;">
</span><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Import-Csv</span><span style="color:#000000;"> {
    </span><span style="color:#008000;">&lt;#</span><span style="color:#008000;">

    .ForwardHelpTargetName Import-Csv
    .ForwardHelpCategory Cmdlet

    </span><span style="color:#008000;">#&gt;</span><span style="color:#000000;">

    [CmdletBinding(DefaultParameterSetName</span><span style="color:#ff0000;">=</span><span style="color:#800000;">'</span><span style="color:#800000;">Delimiter</span><span style="color:#800000;">'</span><span style="color:#000000;">)]
    </span><span style="color:#0000ff;">param</span><span style="color:#000000;">(
        [Parameter(ParameterSetName</span><span style="color:#ff0000;">=</span><span style="color:#800000;">'</span><span style="color:#800000;">Delimiter</span><span style="color:#800000;">'</span><span style="color:#000000;">, Position</span><span style="color:#ff0000;">=</span><span style="color:#000000;">1</span><span style="color:#000000;">)]
        [ValidateNotNull()]
        [</span><span style="color:#008080;">System.Char</span><span style="color:#000000;">]
        </span><span style="color:#800080;">${Delimiter}</span><span style="color:#000000;">,

        [Parameter(Mandatory</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$true</span><span style="color:#000000;">, Position</span><span style="color:#ff0000;">=</span><span style="color:#000000;">0</span><span style="color:#000000;">, ValueFromPipeline</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$true</span><span style="color:#000000;">, ValueFromPipelineByPropertyName</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$true</span><span style="color:#000000;">)]
        [Alias(</span><span style="color:#800000;">'</span><span style="color:#800000;">PSPath</span><span style="color:#800000;">'</span><span style="color:#000000;">)]
        [</span><span style="color:#008080;">System.String</span><span style="color:#000000;">[]]
        </span><span style="color:#800080;">${Path}</span><span style="color:#000000;">,

        [Parameter(ParameterSetName</span><span style="color:#ff0000;">=</span><span style="color:#800000;">'</span><span style="color:#800000;">UseCulture</span><span style="color:#800000;">'</span><span style="color:#000000;">, Mandatory</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$true</span><span style="color:#000000;">)]
        [ValidateNotNull()]
        [</span><span style="color:#008080;">Switch</span><span style="color:#000000;">]
        </span><span style="color:#800080;">${UseCulture}</span><span style="color:#000000;">,

        [ValidateNotNullOrEmpty()]
        [</span><span style="color:#008080;">System.String</span><span style="color:#000000;">[]]
        </span><span style="color:#800080;">${Header}</span><span style="color:#000000;">,

        [ValidateNotNullOrEmpty()]
        [</span><span style="color:#008080;">System.String</span><span style="color:#000000;">[]]
        </span><span style="color:#800080;">${Type}</span><span style="color:#000000;">,

        [ValidateNotNullOrEmpty()]
        [</span><span style="color:#008080;">System.Collections.Hashtable</span><span style="color:#000000;">]
        </span><span style="color:#800080;">${TypeMap}</span><span style="color:#000000;">,

        [ValidateNotNullOrEmpty()]
        [</span><span style="color:#008080;">System.String</span><span style="color:#000000;">]
        </span><span style="color:#800080;">${As}</span><span style="color:#000000;">,

        [Alias(</span><span style="color:#800000;">'</span><span style="color:#800000;">UseETS</span><span style="color:#800000;">'</span><span style="color:#000000;">)]
        [ValidateNotNull()]
        [</span><span style="color:#008080;">Switch</span><span style="color:#000000;">]
        </span><span style="color:#800080;">${UseExtendedTypeSystem}</span><span style="color:#000000;">,

        [ValidateNotNull()]
        [</span><span style="color:#008080;">Switch</span><span style="color:#000000;">]
        </span><span style="color:#800080;">${OverwriteTypeHierarchy}</span><span style="color:#000000;">
    )

    </span><span style="color:#0000ff;">begin</span><span style="color:#000000;"> {
        </span><span style="color:#0000ff;">try</span><span style="color:#000000;"> {
            </span><span style="color:#800080;">$outBuffer</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$null</span><span style="color:#000000;">
            </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">.</span><span style="color:#8b4513;">TryGetValue</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">OutBuffer</span><span style="color:#800000;">'</span><span style="color:#000000;">, [</span><span style="color:#008080;">ref</span><span style="color:#000000;">]</span><span style="color:#800080;">$outBuffer</span><span style="color:#000000;">)) {
                </span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">[</span><span style="color:#800000;">'</span><span style="color:#800000;">OutBuffer</span><span style="color:#800000;">'</span><span style="color:#000000;">] </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">1</span><span style="color:#000000;">
            }
            </span><span style="color:#800080;">$wrappedCmd</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$ExecutionContext</span><span style="color:#000000;">.</span><span style="color:#8b4513;">InvokeCommand</span><span style="color:#000000;">.</span><span style="color:#8b4513;">GetCommand</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">Import-Csv</span><span style="color:#800000;">'</span><span style="color:#000000;">, [</span><span style="color:#008080;">System.Management.Automation.CommandTypes</span><span style="color:#000000;">]::</span><span style="color:#8b4513;">Cmdlet</span><span style="color:#000000;">)

            </span><span style="color:#0000ff;">#region</span><span style="color:#000000;"> Initialize helper variables used in the processing of the additional parameters.
            </span><span style="color:#800080;">$scriptCmdPipeline</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">''</span><span style="color:#000000;">
            </span><span style="color:#0000ff;">#endregion</span><span style="color:#000000;">

            </span><span style="color:#0000ff;">#region</span><span style="color:#000000;"> Process and remove the Type parameter if it is present, modifying the pipelined command appropriately.
            </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$Type</span><span style="color:#000000;">) {
                </span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">.</span><span style="color:#8b4513;">Remove</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">Type</span><span style="color:#800000;">'</span><span style="color:#000000;">) | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
                </span><span style="color:#800080;">$scriptCmdPipeline</span><span style="color:#000000;"> </span><span style="color:#ff0000;">+=</span><span style="color:#000000;"> </span><span style="color:#800000;">@'
</span><span style="color:#800000;"> | ForEach-Object {
    for ($index = 0; ($index -lt @($_.PSObject.Properties).Count) -and ($index -lt @($Type).Count); $index++) {
        $typeObject = [System.Type](@($Type)[$index])
        $propertyName = @($_.PSObject.Properties)[$index].Name
        $_.$propertyName = &amp; $ExecutionContext.InvokeCommand.NewScriptBlock(&quot;[$($typeObject.FullName)]`$_.`$propertyName&quot;)
    }
    $_
}
</span><span style="color:#800000;">'@</span><span style="color:#000000;">
            }
            </span><span style="color:#0000ff;">#endregion</span><span style="color:#000000;">

            </span><span style="color:#0000ff;">#region</span><span style="color:#000000;"> Process and remove the TypeMap parameter if it is present, modifying the pipelined command appropriately.
            </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$TypeMap</span><span style="color:#000000;">) {
                </span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">.</span><span style="color:#8b4513;">Remove</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">TypeMap</span><span style="color:#800000;">'</span><span style="color:#000000;">) | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
                </span><span style="color:#800080;">$scriptCmdPipeline</span><span style="color:#000000;"> </span><span style="color:#ff0000;">+=</span><span style="color:#000000;"> </span><span style="color:#800000;">@'
</span><span style="color:#800000;"> | ForEach-Object {
     foreach ($key in $TypeMap.keys) {
        if ($TypeMap[$key] -is [System.Type]) {
            $typeObject = $TypeMap[$key]
        } else {
            $typeObject = [System.Type]($TypeMap[$key])
        }
        $_.$key = &amp; $ExecutionContext.InvokeCommand.NewScriptBlock(&quot;[$($typeObject.FullName)]`$_.`$key&quot;)
    }
    $_
}
</span><span style="color:#800000;">'@</span><span style="color:#000000;">
            }
            </span><span style="color:#0000ff;">#endregion</span><span style="color:#000000;">

            </span><span style="color:#0000ff;">#region</span><span style="color:#000000;"> Process and remove the As, UseExtendedTypeSystem and OverwriteTypeHierarchy parameters if they are present, modifying the pipelined command appropriately.
            </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$As</span><span style="color:#000000;">) {
                </span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">.</span><span style="color:#8b4513;">Remove</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">As</span><span style="color:#800000;">'</span><span style="color:#000000;">) | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
                </span><span style="color:#800080;">$customTypeName</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$As</span><span style="color:#000000;">
                </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$UseExtendedTypeSystem</span><span style="color:#000000;">) {
                    </span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">.</span><span style="color:#8b4513;">Remove</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">UseExtendedTypeSystem</span><span style="color:#800000;">'</span><span style="color:#000000;">) | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
                    </span><span style="color:#800080;">$customTypeName</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800000;">'</span><span style="color:#800000;">$($_.PSObject.TypeNames[0] -replace </span><span style="color:#800000;">''</span><span style="color:#800000;">#.*$</span><span style="color:#800000;">''</span><span style="color:#800000;">,</span><span style="color:#800000;">''''</span><span style="color:#800000;">)#$As</span><span style="color:#800000;">'</span><span style="color:#000000;">
                }
                </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$OverwriteTypeHierarchy</span><span style="color:#000000;">) {
                    </span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">.</span><span style="color:#8b4513;">Remove</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">OverwriteTypeHierarchy</span><span style="color:#800000;">'</span><span style="color:#000000;">) | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
                    </span><span style="color:#800080;">$scriptCmdPipeline</span><span style="color:#000000;"> </span><span style="color:#ff0000;">+=</span><span style="color:#000000;"> </span><span style="color:#800000;">@&quot;
</span><span style="color:#800000;"> | ForEach-Object {
     `$typeName = &quot;$customTypeName&quot;
     `$_.PSObject.TypeNames.Clear()
    `$_.PSObject.TypeNames.Insert(0,`$typeName)
    `$_
}
</span><span style="color:#800000;">&quot;@</span><span style="color:#000000;">
                } </span><span style="color:#0000ff;">else</span><span style="color:#000000;"> {
                    </span><span style="color:#800080;">$scriptCmdPipeline</span><span style="color:#000000;"> </span><span style="color:#ff0000;">+=</span><span style="color:#000000;"> </span><span style="color:#800000;">@&quot;
</span><span style="color:#800000;"> | ForEach-Object {
     `$typeName = &quot;$customTypeName&quot;
    `$_.PSObject.TypeNames.Insert(0,`$typeName)
    `$_
}
</span><span style="color:#800000;">&quot;@</span><span style="color:#000000;">
                }
            } </span><span style="color:#0000ff;">else</span><span style="color:#000000;"> {
                </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$UseExtendedTypeSystem</span><span style="color:#000000;">) {
                    </span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">.</span><span style="color:#8b4513;">Remove</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">UseExtendedTypeSystem</span><span style="color:#800000;">'</span><span style="color:#000000;">) | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
                }
                </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$OverwriteTypeHierarchy</span><span style="color:#000000;">) {
                    </span><span style="color:#800080;">$PSBoundParameters</span><span style="color:#000000;">.</span><span style="color:#8b4513;">Remove</span><span style="color:#000000;">(</span><span style="color:#800000;">'</span><span style="color:#800000;">OverwriteTypeHierarchy</span><span style="color:#800000;">'</span><span style="color:#000000;">) | </span><span style="color:#5f9ea0;font-weight:bold;">Out-Null</span><span style="color:#000000;">
                }
            }
            </span><span style="color:#0000ff;">#endregion</span><span style="color:#000000;">

            </span><span style="color:#800080;">$scriptCmd</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> {&amp; </span><span style="color:#800080;">$wrappedCmd</span><span style="color:#000000;"> @PSBoundParameters}

            </span><span style="color:#0000ff;">#region</span><span style="color:#000000;"> Append our pipeline command to the end of the wrapped command script block.
            </span><span style="color:#800080;">$scriptCmd</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$ExecutionContext</span><span style="color:#000000;">.</span><span style="color:#8b4513;">InvokeCommand</span><span style="color:#000000;">.</span><span style="color:#8b4513;">NewScriptBlock</span><span style="color:#000000;">(([</span><span style="color:#008080;">string</span><span style="color:#000000;">]</span><span style="color:#800080;">$scriptCmd</span><span style="color:#000000;"> </span><span style="color:#ff0000;">+</span><span style="color:#000000;"> </span><span style="color:#800080;">$scriptCmdPipeline</span><span style="color:#000000;">))
            </span><span style="color:#0000ff;">#endregion</span><span style="color:#000000;">

            </span><span style="color:#800080;">$steppablePipeline</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$scriptCmd</span><span style="color:#000000;">.GetSteppablePipeline(</span><span style="color:#800080;">$myInvocation</span><span style="color:#000000;">.CommandOrigin)
            </span><span style="color:#800080;">$steppablePipeline</span><span style="color:#000000;">.Begin(</span><span style="color:#800080;">$PSCmdlet</span><span style="color:#000000;">)
        }
        </span><span style="color:#0000ff;">catch</span><span style="color:#000000;"> {
            </span><span style="color:#0000ff;">throw</span><span style="color:#000000;">
        }
    }

    </span><span style="color:#0000ff;">process</span><span style="color:#000000;"> {
        </span><span style="color:#0000ff;">try</span><span style="color:#000000;"> {
            </span><span style="color:#800080;">$steppablePipeline</span><span style="color:#000000;">.Process(</span><span style="color:#800080;">$_</span><span style="color:#000000;">)
        }
        </span><span style="color:#0000ff;">catch</span><span style="color:#000000;"> {
            </span><span style="color:#0000ff;">throw</span><span style="color:#000000;">
        }
    }

    </span><span style="color:#0000ff;">end</span><span style="color:#000000;"> {
        </span><span style="color:#0000ff;">try</span><span style="color:#000000;"> {
            </span><span style="color:#800080;">$steppablePipeline</span><span style="color:#000000;">.End()
        }
        </span><span style="color:#0000ff;">catch</span><span style="color:#000000;"> {
            </span><span style="color:#0000ff;">throw</span><span style="color:#000000;">
        }
    }
}</span></pre>
<p>Are you still with me?&#160; Whew, if you stuck with me this far, thanks!&#160; There’s a lot of information here, and while it’s definitely not something for a beginner, if you’re comfortable experimenting in PowerShell I encourage you to give proxy functions a try and see what solutions you can come up with.&#160; Or, if you don’t mind taking the time to leave me a note, let me know what your biggest pains are with cmdlets today that you think could be solved with proxy functions and I’ll see what I can do to help create solutions for those.&#160; The feedback system really works, so don’t be shy, participate by either sharing solutions or letting others like me know what your problems are so that we can continue to help evolve PowerShell into the best scripting environment out there!</p>
<p>Thanks for listening!</p>
<p>Kirk out.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8fb808ce-0f03-4106-956d-8127c4576daa" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Proxy+function" rel="tag">Proxy function</a>,<a href="http://technorati.com/tags/PowerShell+3.0" rel="tag">PowerShell 3.0</a>,<a href="http://technorati.com/tags/Import-Csv" rel="tag">Import-Csv</a></div>
<p><span class="sbmLink"></p>
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this: </td>
<td><a title="Post it to Social!" href="http://social.microsoft.com/en-us/action/create/s/E/?url=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;ttl=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/social.png" /></a></td>
<td><a title="Post it to Technet!" href="http://social.technet.microsoft.com/en-us/action/create/s/E/?url=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;ttl=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/technet.png" /></a></td>
<td><a title="Post it to Blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;title=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td><a title="Post it to Del.icio.us!" href="http://del.icio.us/post?url=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;;title=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td><a title="Post it to Del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;title=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td><a title="Post it to Digg!" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;title=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td><a title="Post it to Facebook!" href="http://www.facebook.com/sharer.php?u=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;t=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.technet.com/photos/james/images/1765319/original.aspx" /></a></td>
<td><a title="Post it to Furl!" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;ti=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td><a title="Post it to Reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;title=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td><a title="Post it to Spurl!" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;title=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td><a title="Post it to Technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;title=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td><a title="Post it to Yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/09/18/powershell-3.0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/&amp;t=PowerShell 3.0: Why wait? Importing typed objects with typed properties from a csv file" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
<p></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/275/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=275&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/MrCOJrwv8s8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/09/18/powershell-3-0-why-wait-importing-typed-objects-with-typed-properties-from-a-csv-file/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/social.png" medium="image" />

		<media:content url="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/technet.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.technet.com/photos/james/images/1765319/original.aspx" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Learn PowerShell v2 features using PowerShell code snippets</title>
		<link>http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/</link>
		<comments>http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 13:46:51 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[Poshoholic Studios]]></category>
		<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerGUI Quick Tip]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[Quick Tip]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/?p=264</guid>
		<description><![CDATA[Learning and using PowerShell v2 features just got easier!&#160; Earlier this week I uploaded a collection of PowerShell v2 code snippets to the PowerGUI website, and they are ready for you to download and use.&#160; All you need to do is follow the installation instructions in the snippet document.
Once you have the snippets installed, watch [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=264&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Learning and using PowerShell v2 features just got easier!&#160; Earlier this week I uploaded a collection of <a title="PowerShell v2 code snippets" href="http://www.powergui.org/entry.jspa?externalID=2472&amp;categoryID=299" target="_blank">PowerShell v2 code snippets</a> to the <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> website, and they are ready for you to download and use.&#160; All you need to do is follow the installation instructions in the <a title="PowerShell v2 Code Snippets" href="http://www.powergui.org/entry.jspa?externalID=2472&amp;categoryID=299" target="_blank">snippet document</a>.</p>
<p>Once you have the snippets installed, watch the <a title="What&#39;s new in PowerShell v2" href="http://powergui.org/shares/powergui/sbin/docs/PowerShell_v2_Snippets/PowerShell_v2_Snippets.html" target="_blank">screencast</a> that demonstrates how you can learn more about some PowerShell v2 features by using the v2 code snippets.&#160; You can watch it in <a title="What&#39;s new in PowerShell v2" href="http://powergui.org/shares/powergui/sbin/docs/PowerShell_v2_Snippets/PowerShell_v2_Snippets.html" target="_blank">flash format</a> with a table of contents, or you can watch the <a href="http://www.youtube.com/watch?v=0EWnfrUqTpE" target="_blank">YouTube version</a> below.</p>
</p>
<p align="left"><span style="text-align:center; display: block;"><a href="http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/"><img src="http://img.youtube.com/vi/0EWnfrUqTpE/2.jpg" alt="" /></a></span> </p>
<p>Want to see more snippets?&#160; Let me know which areas of PowerShell you would like to see covered in snippets by leaving me a note in the comments.</p>
<p>Enjoy!</p>
<p>Kirk out.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:3fab71d8-5588-4e7d-ba02-608a1bef2680" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Quick+Tip" rel="tag">Quick Tip</a>,<a href="http://technorati.com/tags/Poshoholic+Studios" rel="tag">Poshoholic Studios</a></div>
<p><span class="sbmLink"></span></p>
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;title=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;;title=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;title=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;title=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;ti=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;title=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;title=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;title=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/&amp;t=Learn PowerShell v2 features using PowerShell code snippets" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/264/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=264&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/aW-5ahNXHhY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/08/28/learn-powershell-v2-features-using-powershell-code-snippets/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/0EWnfrUqTpE/2.jpg" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Recover deleted Active Directory objects with the AD Recycle Bin PowerPack</title>
		<link>http://poshoholic.com/2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/</link>
		<comments>http://poshoholic.com/2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 06:22:14 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerPack]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[AD]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[PowerShell v2]]></category>
		<category><![CDATA[Recycle Bin]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/</guid>
		<description><![CDATA[Last week Microsoft made the announcement that Windows Server 2008 R2 reached RTM.&#160; Among the many cool new features provided with that release (Hello?&#160; PowerShell v2?&#160; Need I say more?), Microsoft has now added a recycle bin feature to Active Directory.&#160; The management interface provided by Microsoft for this feature is the command line, or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=257&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Last week Microsoft made the <a title="Windows Server 2008 R2 RTM bits available today" href="http://blogs.technet.com/windowsserver/archive/2009/08/14/windows-server-2008-r2-rtm-bits-available-today.aspx" target="_blank">announcement</a> that Windows Server 2008 R2 reached RTM.&#160; Among the many cool new features provided with that release (Hello?&#160; PowerShell v2?&#160; Need I say more?), Microsoft has now added a recycle bin feature to Active Directory.&#160; The management interface provided by Microsoft for this feature is the command line, or more specifically, PowerShell.&#160; That’s great if you’re like me and you love to manage your infrastructure using PowerShell, but what if you prefer a GUI?&#160; Fortunately there is a solution for you too.</p>
<p>As Jackson Shaw <a title="Active Directory&#39;s Recycle Bin" href="http://jacksonshaw.blogspot.com/2009/08/active-directorys-recycle-bin.html" target="_blank">suggested on his blog</a> about a week ago, <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> provides an admin console that allows you to create your own management UI that is layered on top of PowerShell.&#160; This admin console can be extended with PowerPacks, which are essentially add-ins that provide additional user interface elements in <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> that invoke PowerShell script when clicked.&#160; All you need to do is add the user interface elements you want and then provide the scripts to power those elements, managing the Active Directory Recycle Bin objects or anything else you need to manage.&#160; Or alternatively you can check to see if someone on the <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> Community like myself has already created a PowerPack with the functionality you are looking for.</p>
<p>In the case of the Active Directory Recycle Bin, you’re in luck.&#160; I just finished creating the first release of a new PowerPack that is designed to allow you to manage any objects in your recycle bin.&#160; You can find the <a title="Active Directory Recycle Bin PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2461&amp;categoryID=21" target="_blank">Active Directory Recycle Bin PowerPack</a> by following the hyperlink <a title="Active Directory Recycle Bin PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2461&amp;categoryID=21" target="_blank">here</a> or by going directly to <a href="http://www.powergui.org">http://www.powergui.org</a> and browsing into the Active Directory subcategory in the <a title="PowerPack Library" href="http://www.powergui.org/kbcategory.jspa?categoryID=21" target="_blank">PowerPack Library</a>.&#160; This PowerPack includes the following features:</p>
<ul>
<li>View the contents of the recycle bin, including hierarchies </li>
<li>Restore individual items in the recycle bin (recursively or not) to their original location </li>
<li>Restore individual items in the recycle bin (recursively or not) to a specified location </li>
<li>Permanently delete objects in the recycle bin (recursively or not) </li>
<li>Empty the contents of the recycle bin </li>
<li>Modify the number of days that the recycle bin is configured to retain objects and the number of days that objects are to be kept in a tombstone state before permanent deletion </li>
</ul>
<p>If you would like to see a demo of the <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2461&amp;categoryID=21" target="_blank">Active Directory Recycle Bin PowerPack</a>, watch this screencast:</p>
<p><span style="text-align:center; display: block;"><a href="http://poshoholic.com/2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/"><img src="http://img.youtube.com/vi/MI1Tdual0wE/2.jpg" alt="" /></a></span></p>
<p>If you prefer watching a high resolution version of the screencast, you can watch it in flash format <a title="Getting Started with the Active Directory Recycle Bin PowerPack" href="http://powergui.org/shares/powergui/sbin/docs/AD_Recycle_Bin_PowerPack/AD_Recycle_Bin_PowerPack.html" target="_blank">here</a> or on YouTube directly in HD format <a title="Getting started with the Active Directory Recycle Bin PowerPack" href="http://www.youtube.com/watch?v=MI1Tdual0wE&amp;hd=1" target="_blank">here</a>.</p>
<p>This is the initial release of this PowerPack and it contains a good amount of new functionality.&#160; If you are experimenting with the Active Directory Recycle Bin feature, please take a look at this PowerPack and provide any feedback you have so that we can continue to provide improvements that are valuable to you and others in future releases.</p>
<p>Thanks for listening!</p>
<p>Kirk out.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a41b5fdd-2199-43c1-bb21-bd820a495f65" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Active+Directory" rel="tag">Active Directory</a>,<a href="http://technorati.com/tags/AD" rel="tag">AD</a>,<a href="http://technorati.com/tags/Recycle+Bin" rel="tag">Recycle Bin</a>,<a href="http://technorati.com/tags/PowerShell+v2" rel="tag">PowerShell v2</a>,<a href="http://technorati.com/tags/PowerPack" rel="tag">PowerPack</a></div>
<p><span class="sbmLink"></span></p>
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;title=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;;title=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;title=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;title=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;ti=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;title=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;title=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;title=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/&amp;t=Recover deleted Active Directory objects with the AD Recycle Bin PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/257/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=257&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/8A9FX104d80" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/08/18/recover-deleted-active-directory-objects-with-the-ad-recycle-bin-powerpack/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/MI1Tdual0wE/2.jpg" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Essential PowerShell: Know your operator and enclosure precedence</title>
		<link>http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/</link>
		<comments>http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 04:26:31 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[Essential PowerShell]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[enclosure precedence]]></category>
		<category><![CDATA[operator precedence]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/</guid>
		<description><![CDATA[PowerShell version 1 comes with a lot of operators, and the list becomes even longer in version 2 with cool new operators like -split and -join.&#160; Whether you’re writing scripts or using PowerShell interactively, dealing with multiple operators in an expression that possibly contains different enclosures (brackets, quotation marks, etc.) as well can be very [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=246&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>PowerShell version 1 comes with a lot of operators, and the list becomes even longer in version 2 with cool new operators like -split and -join.&#160; Whether you’re writing scripts or using PowerShell interactively, dealing with multiple operators in an expression that possibly contains different enclosures (brackets, quotation marks, etc.) as well can be very tricky.&#160; It is very important to know how the PowerShell interpreter processes the expression so that you can get your expressions right the first time or, if you’re not so lucky, so that you can identify the problem in your expressions later and fix them.</p>
<p>Recently there have been several posts on the forums where the problem has been a lack of understanding of the operator and enclosure precedence in PowerShell.&#160; That’s not too surprising because the precedence order used by the PowerShell interpreter doesn’t seem to be documented at this time.&#160; You can find the precedence order of arithmetic operators through the about_arithmetic_operators help file, you can find out some precedence details for specific operators in various operator help files, and you can find out the precedence of command types through the about_command_precedence help file, but that’s about it.&#160; There is no single help file that documents the overall operator and enclosure precedence.&#160; It doesn’t seem to be listed in any of the PowerShell books I have read either.</p>
<p>Fortunately through some ad hoc experimentation and through some reading of the help documentation that does exist it is possible to figure out how all of this works.&#160; I’ve gone through that exercise recently and the resulting table of operator and enclosure precedence is below.&#160; Before getting to the table though there are a few important things I should mention, as follows:</p>
<ol>
<li>Any items that share the same row in the table have the same precedence and are evaluated from left to right when adjacent within an expression unless otherwise indicated. </li>
<li>The intent of this table is to identify a precedence that can be used to create or troubleshoot more complicated expressions without a lot of guesswork.&#160; It is not intended to explain what each of the operators are and how you can use them (although to help understand expressions you might have to deal with I do mention a few details about some operators that function differently than the majority of operators in PowerShell). </li>
<li>If you want to learn about the individual operators and see examples showing how they can be used I recommend you consult the about_operators help file and all of its related files. </li>
</ol>
<p>With that out of the way, here is the operator and enclosure precedence table for PowerShell:</p>
<table border="0" rules="rows" cellspacing="0" cellpadding="2" width="595">
<tbody>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">[]</td>
<td valign="top" width="240">Type enclosures</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">Any character placed inside of these enclosures is treated as part of a literal type name.&#160; The contents are not evaluated like an expression would be.</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">&quot; &quot;</td>
<td valign="top" width="240">Double-quoted string enclosures</td>
</tr>
<tr>
<td valign="top" width="87">&#8216; &#8216;</td>
<td valign="top" width="240">Single-quoted string enclosures</td>
</tr>
<tr>
<td valign="top" width="87">@&quot; &quot;@</td>
<td valign="top" width="240">Double-quoted here-string enclosures</td>
</tr>
<tr>
<td valign="top" width="87">@&#8217; &#8216;@</td>
<td valign="top" width="240">Single-quoted here-string enclosures</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">{}</td>
<td valign="top" width="240">Script block enclosures</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">()</td>
<td valign="top" width="240">Nested expression enclosures</td>
</tr>
<tr>
<td valign="top" width="87">@()</td>
<td valign="top" width="240">Array subexpression enclosures</td>
</tr>
<tr>
<td valign="top" width="87">$()</td>
<td valign="top" width="240">Subexpression enclosures</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">.</td>
<td valign="top" width="240">Property dereference operator</td>
</tr>
<tr>
<td valign="top" width="87">::</td>
<td valign="top" width="240">Static member operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">[]</td>
<td valign="top" width="240">Index operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">[int]                  <br />[string[]]                   <br />etc.</td>
<td valign="top" width="240">Cast operators</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">Multiple adjacent operators in this row have a right-to-left evaluation.</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">-split (unary)</td>
<td valign="top" width="240">Split operator (unary)</td>
</tr>
<tr>
<td valign="top" width="87">-join (unary)</td>
<td valign="top" width="240">Join operator (unary)</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">These operators can be used as unary or binary operators.&#160; Their precedence varies depending on how they are used.</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">,</td>
<td valign="top" width="240">Comma operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">This operator is the array element separator.&#160; It can be used as an unary or binary operator.</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">++</td>
<td valign="top" width="240">Increment operator</td>
</tr>
<tr>
<td valign="top" width="87">&#8211;</td>
<td valign="top" width="240">Decrement operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">These unary operators can be used before or after a variable or property.&#160; When used before the variable or property, the value is incremented or decremented first and then the result is passed into the expression in which it is contained.&#160; When used after the variable or property, the value is passed into the expression in which it is contained and then the variable or property is immediately incremented or decremented.</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">-</td>
<td valign="top" width="240">Negate operator</td>
</tr>
<tr>
<td valign="top" width="87">-not</td>
<td valign="top" width="240">Not operator</td>
</tr>
<tr>
<td valign="top" width="87">!</td>
<td valign="top" width="240">Not operator</td>
</tr>
<tr>
<td valign="top" width="87">-bnot</td>
<td valign="top" width="240">Bitwise not operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">Multiple adjacent operators in this row have a right-to-left evaluation.</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">..</td>
<td valign="top" width="240">Range operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">-f</td>
<td valign="top" width="240">Format operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">*</td>
<td valign="top" width="240">Multiplication operator</td>
</tr>
<tr>
<td valign="top" width="87">/</td>
<td valign="top" width="240">Division operator</td>
</tr>
<tr>
<td valign="top" width="87">%</td>
<td valign="top" width="240">Modulus operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">+</td>
<td valign="top" width="240">Addition operator</td>
</tr>
<tr>
<td valign="top" width="87">-</td>
<td valign="top" width="240">Subtraction operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="87">-split                  <br />-isplit                   <br />-csplit (binary) </td>
<td valign="top" width="240">Split operator (binary)</td>
</tr>
<tr>
<td valign="top" width="87">-join (binary)</td>
<td valign="top" width="240">Join operator (binary)</td>
</tr>
<tr>
<td valign="top" width="87">-is</td>
<td valign="top" width="240">Type is operator</td>
</tr>
<tr>
<td valign="top" width="87">-isnot</td>
<td valign="top" width="240">Type is not operator</td>
</tr>
<tr>
<td valign="top" width="87">-as</td>
<td valign="top" width="240">Type as operator</td>
</tr>
<tr>
<td valign="top" width="87">-eq                  <br />-ieq                   <br />-ceq</td>
<td valign="top" width="240">Equal to operator</td>
</tr>
<tr>
<td valign="top" width="87">-ne                  <br />-ine                   <br />-cne</td>
<td valign="top" width="240">Not equal to operator</td>
</tr>
<tr>
<td valign="top" width="87">-gt                  <br />-igt                   <br />-cgt</td>
<td valign="top" width="240">Greater than operator</td>
</tr>
<tr>
<td valign="top" width="87">-ge                  <br />-ige                   <br />-cge</td>
<td valign="top" width="240">Greater than or equal to operator</td>
</tr>
<tr>
<td valign="top" width="87">-lt                  <br />-ilt                   <br />-clt</td>
<td valign="top" width="240">Less than operator</td>
</tr>
<tr>
<td valign="top" width="87">-le                  <br />-ile                   <br />-cle</td>
<td valign="top" width="240">Less than or equal to operator</td>
</tr>
<tr>
<td valign="top" width="87">-like                  <br />-ilike                   <br />-clike</td>
<td valign="top" width="240">Like operator</td>
</tr>
<tr>
<td valign="top" width="87">-notlike                  <br />-inotlike                   <br />-cnotlike</td>
<td valign="top" width="240">Not like operator</td>
</tr>
<tr>
<td valign="top" width="87">-match                  <br />-imatch                   <br />-cmatch</td>
<td valign="top" width="240">Match operator</td>
</tr>
<tr>
<td valign="top" width="87">-notmatch                  <br />-inotmatch                   <br />-cnotmatch</td>
<td valign="top" width="240">Not match operator</td>
</tr>
<tr>
<td valign="top" width="87">-contains                  <br />-icontains                   <br />-ccontains</td>
<td valign="top" width="240">Contains operator</td>
</tr>
<tr>
<td valign="top" width="87">-notcontains                  <br />-inotcontains                   <br />-cnotcontains</td>
<td valign="top" width="240">Does not contain operator</td>
</tr>
<tr>
<td valign="top" width="87">-replace                  <br />-ireplace                   <br />-creplace</td>
<td valign="top" width="240">Replace operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">With the exception of the join operator and the type operators (-is, -isnot, and –as), each of the operators in this row has a case-sensitive and an explicit case-insensitive variant.&#160; Case-sensitive variants are prefixed with c (e.g. -ceq) and case-insensitive variants are prefixed with i (e.g. –ireplace).</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="327">
<tbody>
<tr>
<td valign="top" width="92">-band</td>
<td valign="top" width="233">Bitwise and operator</td>
</tr>
<tr>
<td valign="top" width="92">-bor</td>
<td valign="top" width="233">Bitwise or operator</td>
</tr>
<tr>
<td valign="top" width="92">-bxor</td>
<td valign="top" width="233">Bitwise exclusive or operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="328">
<tbody>
<tr>
<td valign="top" width="92">-and</td>
<td valign="top" width="234">Logical and operator</td>
</tr>
<tr>
<td valign="top" width="92">-or</td>
<td valign="top" width="234">Logical or operator</td>
</tr>
<tr>
<td valign="top" width="92">-xor</td>
<td valign="top" width="234">Logical exclusive or operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">&#160;</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="327">
<tbody>
<tr>
<td valign="top" width="92">.</td>
<td valign="top" width="233">Dot-sourcing operator</td>
</tr>
<tr>
<td valign="top" width="92">&amp;</td>
<td valign="top" width="233">Call operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">Unary operators that are only valid at the beginning of an expression, a nested expression, or a subexpression.</td>
</tr>
<tr>
<td valign="top" width="285">
<table border="0" cellspacing="0" cellpadding="2" width="329">
<tbody>
<tr>
<td valign="top" width="92">=</td>
<td valign="top" width="235">Assignment operator</td>
</tr>
<tr>
<td valign="top" width="92">+=</td>
<td valign="top" width="235">Assignment by addition operator</td>
</tr>
<tr>
<td valign="top" width="92">-=</td>
<td valign="top" width="235">Assignment by subtraction operator</td>
</tr>
<tr>
<td valign="top" width="92">*=</td>
<td valign="top" width="235">Assignment by multiplication operator</td>
</tr>
<tr>
<td valign="top" width="92">/=</td>
<td valign="top" width="235">Assignment by division operator</td>
</tr>
<tr>
<td valign="top" width="92">%=</td>
<td valign="top" width="235">Assignment by modulus operator</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" width="308">Multiple adjacent operators in this row have a right-to-left evaluation.</td>
</tr>
</tbody>
</table>
<p>Since this table is created through experimentation and through snippets of information about precedence that I was able to find in the help files, it may not be entirely accurate.&#160; If you find any problems with the precedence information provided here, please let me know and I’ll update this table accordingly.</p>
<p><em>[Update 09-July-2009: Fixed table formatting, added an index operator, added all case-sensitive and case-insensitive variants and adjusted the precedence for the property dereference and static member operators.]</em></p>
<p>Thanks,</p>
<p>Kirk out.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2d6b6351-e620-48de-af54-fa6d86694f49" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/Essential+PowerShell" rel="tag">Essential PowerShell</a>,<a href="http://technorati.com/tags/operator+precedence" rel="tag">operator precedence</a>,<a href="http://technorati.com/tags/enclosure+precedence" rel="tag">enclosure precedence</a></div>
<p><span class="sbmLink"><span class="sbmLink"><span class="sbmLink"></span><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;title=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;;title=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;title=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;title=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;ti=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;title=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;title=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;title=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/&amp;t=Essential PowerShell: Know your operator and enclosure precedence" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
<p>     </span></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=246&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/hgHmzI9EmoY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/07/08/essential-powershell-know-your-operator-and-enclosure-precedence/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>PowerShell Quick Tip: When you store an array, make sure it is an array</title>
		<link>http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/</link>
		<comments>http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 15:25:44 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Quick Tip]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[Quick Tip]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/</guid>
		<description><![CDATA[It is not uncommon to want to store the results of a command in an array so that you can refer to the contents of that array later in your script.&#160; This is often done by simply assigning the results of a command to a variable.&#160; For example, if you were importing the contents of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=244&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It is not uncommon to want to store the results of a command in an array so that you can refer to the contents of that array later in your script.&#160; This is often done by simply assigning the results of a command to a variable.&#160; For example, if you were importing the contents of a csv file into an array you might do it like this:</p>
<blockquote><p>$collection = Import-Csv C:\newusers.csv</p>
</blockquote>
<p>Commands like this will work forever as long as you have a csv file in the appropriate location.&#160; Occasionally though you may find that a script containing this command just stops working.&#160; It might not make sense to you at the time because the script hasn’t changed, so what’s the problem?</p>
<p>The problem is that in the above command there is no guarantee that $collection will actually store an array of objects because there is no guarantee that Import-Csv will return more than one object.&#160; In fact, there is no guarantee that Import-Csv will return any objects at all.&#160; If the C:\newusers.csv file is generated by some other tool, it is possible that it might contain 0, 1 or more entries.&#160; When it contains 0 or 1 entries, the $collection variable will either be $null or it will contain one object representing the single entry in the C:\newusers.csv file, respectively.&#160; If further down in your script you’re always treating $collection as if it is an array and using indices to access elements in the array, your script will suddenly start failing with errors.</p>
<p>Fortunately there is a way to ensure that the results of any command are stored in an array.&#160; All you need to do is wrap the command that returns the object(s) in array enclosures, like this:</p>
<blockquote><p>$collection = @(Import-Csv C:\newusers.csv)</p>
</blockquote>
<p>If you take this approach in your script and then later when you run your script C:\newusers.csv only contains one entry or perhaps doesn’t contain any entries at all, your $collection variable will still be an array so that you can check the size using the Count property ($collection.Count), access individual values using indices (e.g. $collection[0]), etc.&#160; This is a much safer practice to take when writing your scripts so that you can make sure that you have an array when you store an array.</p>
<p>Of course if you are dealing with very large collections of objects that aren’t already loaded in memory an even better practice is to avoid storing the entire collection in memory altogether by using pipelines and cmdlets like <a title="Essential PowerShell: Understanding foreach" href="http://poshoholic.com/2007/08/21/essential-powershell-understanding-foreach/" target="_blank">ForEach-Object</a> to process the items in the collection, but I wanted to make sure you were aware of how you should properly handle and store arrays in variables in your scripts so that you’re not facing a script long after it has been written and asking yourself why it suddenly stopped working.&#160; There are plenty of other reasons why a script could stop working at some point but at least now you’re armed with the knowledge required to avoid one of those possibilities.</p>
<p>Kirk out.</p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:98874118-5b0d-4637-ab89-6339a2239f2a" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/Quick+Tip" rel="tag">Quick Tip</a></div>
</p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;title=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;;title=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;title=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;title=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;ti=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;title=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;title=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;title=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/&amp;t=PowerShell Quick Tip: When you store an array, make sure it is an array" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
<p> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/244/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=244&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/fBZXVCXuIsQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/07/03/powershell-quick-tip-when-you-store-an-array-make-sure-it-is-an-array/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Create your own org chart from AD with PowerGUI!</title>
		<link>http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/</link>
		<comments>http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 07:48:34 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[Poshoholic Studios]]></category>
		<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerPack]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Quest AD Cmdlets]]></category>
		<category><![CDATA[Org Chart]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[Visio]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/</guid>
		<description><![CDATA[Another week has gone by and I have another brand new PowerPack ready for download.&#160; This time around it’s the Org Chart PowerPack.&#160; This is a PowerPack that I put together based on a Get-OrgChart function I wrote to analyze org chart data at work.&#160; It lets you do some really cool things such as:

Dynamically [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=229&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Another week has gone by and I have another brand new PowerPack ready for download.&#160; This time around it’s the <a title="Org Chart PowerPack" href="http://powergui.org/entry.jspa?externalID=2424&amp;categoryID=21" target="_blank">Org Chart PowerPack</a>.&#160; This is a PowerPack that I put together based on a Get-OrgChart function I wrote to analyze org chart data at work.&#160; It lets you do some really cool things such as:</p>
<ol>
<li>Dynamically create an org chart from users in Active Directory using title, department, office, address, and other properties. </li>
<li>Generate a Visio Org Chart from <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> for the any branch of an organization. </li>
<li>Create statistical reports for the employees in your organization to see breakdowns of employees by office, department, management, etc. </li>
<li>Dynamically generate Office Directory reports in HTML when using it in conjunction with the <a title="Advanced Reporting PowerPack" href="http://powergui.org/entry.jspa?categoryID=21&amp;externalID=2423" target="_blank">Advanced Reporting PowerPack</a>. </li>
</ol>
<p>Note: The <a title="Org Chart PowerPack" href="http://powergui.org/entry.jspa?externalID=2424&amp;categoryID=21" target="_blank">Org Chart PowerPack</a> uses the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> to retrieve information from AD so you will need to install those first before you can use the PowerPack.</p>
<p>If you would like to see how this PowerPack can be of benefit to you, check out this screencast:</p>
<p><span style="text-align:center; display: block;"><a href="http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/"><img src="http://img.youtube.com/vi/TRyuVlX3dUY/2.jpg" alt="" /></a></span></p>
<p>This screencast was recorded in HD format so you can click on the HD button once you start watching it to enable high definition video.&#160; Alternatively, if you would prefer to watch a high resolution flash version with a table of contents you can watch the screencast <a title="Getting started with the Org Chart PowerPack" href="http://powergui.org/shares/powergui/sbin/docs/Org_Chart_PowerPack/Org_Chart_PowerPack.html" target="_blank">here</a>.&#160; I decided to try widescreen format this time since that is my format preference…let me know if this is a problem for you.</p>
<p>This is the first release of this PowerPack and I’m anxious to hear what you think so please give it a look and share your feedback so that I can improve it with another update in the future.</p>
<p>Thanks for listening!</p>
<p>Kirk out.</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:39d579cd-7599-4fb2-ac09-7bbb9e26667e" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Org+Chart" rel="tag">Org Chart</a>,<a href="http://technorati.com/tags/Visio" rel="tag">Visio</a>,<a href="http://technorati.com/tags/PowerPack" rel="tag">PowerPack</a>,<a href="http://technorati.com/tags/Quest+AD+Cmdlets" rel="tag">Quest AD Cmdlets</a></div>
<table border="0" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post:</td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;title=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;;title=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;title=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;title=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;ti=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;title=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;title=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;title=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/&amp;t=Create your own org chart from AD with PowerGUI!" target="_blank"><img border="0" alt="" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/229/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=229&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/qJHZgtvK-6o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/06/27/create-your-own-org-chart-from-ad-with-powergui/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/TRyuVlX3dUY/2.jpg" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters</title>
		<link>http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/</link>
		<comments>http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 13:35:57 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Quick Tip]]></category>
		<category><![CDATA[Quest AD Cmdlets]]></category>
		<category><![CDATA[ObjectAttributes]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[Quick Tip]]></category>
		<category><![CDATA[ScriptBlock Parameters]]></category>
		<category><![CDATA[Set-QADObject]]></category>
		<category><![CDATA[UserAccountControl]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/</guid>
		<description><![CDATA[In PowerShell you can pass pipeline data to parameters that are not configured to accept pipeline input using ScriptBlock parameters.&#160; This has been discussed before and it is well worth your time to make yourself familiar with that capability of PowerShell because it allows you to create true one-liners in places where you might think [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=227&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In PowerShell you can pass pipeline data to parameters that are not configured to accept pipeline input using ScriptBlock parameters.&#160; This has been discussed <a title="Flexible pipelining with ScriptBlock Parameters" href="https://blogs.msdn.com/powershell/archive/2006/06/23/643674.aspx" target="_blank">before</a> and it is well worth your time to make yourself familiar with that capability of PowerShell because it allows you to create true one-liners in places where you might think you cannot.&#160; Basically it boils down to this: you can pass a script block into parameters in a cmdlet that is not of type script block and within the script block you provide the $_ variable will contain the object that was just passed down the pipeline.&#160; The script block will be evaluated first, and then the result will be passed into the cmdlet parameter.</p>
<p>Still, even with that knowledge in hand people often trip over the ScriptBlock parameter syntax when using a parameter that takes a hash table (aka an associative array) as input.&#160; The most common example I can think of where this is encountered is in the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a>.</p>
<p>Many of the Quest AD cmdlets have a parameter called ObjectAttributes.&#160; This parameter serves two purposes: in Get cmdlets it is used to define the values you want to filter on; in Set and New cmdlets it is used to define the values you want to assign to specific attributes.&#160; Not consistent, I know, but that’s a whole other discussion.&#160; In both cases the ObjectAttributes parameter is a hash table and to use it you simply need to define a hash table that matches attribute names with values.&#160; Here’s an example showing how users trip over the syntax without realizing it:</p>
<p>Get-QADComputer Comp1 `    <br />&#160;&#160;&#160; | Set-QADObject -ObjectAttributes `&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; @{userAccountControl=$_.userAccountControl -bxor 2}</p>
<p>This one liner was designed to enable or disable a computer object in AD.&#160; It will run without raising an error, and it will even enable or disable the computer object, but it will not work like you might expect.&#160; After running this command the userAccountControl attribute (which contains many flags, not just a flag for enabled/disabled state) will not be properly configured.&#160; Why?&#160; It looks like it is properly using a ScriptBlock parameter, but it is not so the $_.userAccountControl value will either evaluate to 0 if the $_ variable is null or if it does not have a userAccountControl property, or it will contain the userAccountControl value from whatever object the $_ variable contained before you called Get-QADComputer in the first stage of this pipeline.&#160; Nothing in this command instructs PowerShell to treat the ObjectAttributes parameter as a ScriptBlock parameter.&#160; So what’s missing?</p>
<p>The most important thing to remember about ScriptBlock parameters is that they always must be surrounded by script block enclosures (“{“ and “}”).&#160; Otherwise they are not script blocks.&#160; In our example above it looks like the parameter is surrounded by the proper enclosures, but that’s not true.&#160; It’s surrounded by hash table enclosures (“@{“ and “}”), and this is what trips people up when working with this syntax.&#160; To make this be properly treated as a ScriptBlock parameter, we need to surround the hash table with curly braces, like this:</p>
<p> Get-QADComputer Comp1 `   <br />&#160;&#160;&#160; | Set-QADObject -ObjectAttributes `&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {@{userAccountControl=$_.userAccountControl -bxor 2}}
<p>That makes PowerShell recognize that we have a ScriptBlock parameter and the $_ variable within it properly evaluates to the object that just came down the pipeline.&#160; No ForEach-Object or temporary variables required.&#160; It seems simple enough when explaining it but you’d be surprised how many people get tripped up on this syntax.</p>
<p>If you want to see some forum discussions where this has been an issue for others, you can go <a title="Get enabled/disabled computer accounts" href="http://powergui.org/thread.jspa?threadID=7773&amp;tstart=30" target="_blank">here</a> or <a title="How to enable/disable a computer object" href="http://www.powergui.org/thread.jspa?messageID=24467&amp;#24467" target="_blank">here</a>.</p>
<p>Kirk out.</p>
</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:bc477e30-3668-4892-bd40-812481dcccc9" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/Quick+Tip" rel="tag">Quick Tip</a>,<a href="http://technorati.com/tags/Quest+AD+Cmdlets" rel="tag">Quest AD Cmdlets</a>,<a href="http://technorati.com/tags/ScriptBlock+Parameters" rel="tag">ScriptBlock Parameters</a>,<a href="http://technorati.com/tags/ObjectAttributes" rel="tag">ObjectAttributes</a>,<a href="http://technorati.com/tags/UserAccountControl" rel="tag">UserAccountControl</a>,<a href="http://technorati.com/tags/Set-QADObject" rel="tag">Set-QADObject</a></div>
<p> <span class="sbmLink"></span><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;title=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;;title=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;title=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;title=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;ti=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;title=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;title=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;title=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/&amp;t=PowerShell Quick Tip: Setting AD object attributes with ScriptBlock parameters" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/227/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=227&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/cW-gONHOd-c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/06/23/powershell-quick-tip-setting-ad-object-attributes-with-scriptblock-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Just Released: Advanced Reporting PowerPack</title>
		<link>http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/</link>
		<comments>http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 09:40:27 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerPack]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Advanced Reporting]]></category>
		<category><![CDATA[HTML Report]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/06/20/just-released-advanced-reporting-powerpack/</guid>
		<description><![CDATA[I just published a brand new PowerPack to the PowerPack Library called the Advanced Reporting PowerPack.  If you’ve been keeping your eyes on the Virtualization EcoShell project as well as PowerGUI, you may have already come across this PowerPack because I released it there first.
The Advanced Reporting PowerPack allows you to generate HTML reports with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=217&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I just published a brand new PowerPack to the <a title="PowerPack Library" href="http://www.powergui.org/kbcategory.jspa?categoryID=21" target="_blank">PowerPack Library</a> called the <a title="Advanced Reporting PowerPack" href="http://powergui.org/entry.jspa?categoryID=21&amp;externalID=2423" target="_blank">Advanced Reporting PowerPack</a>.  If you’ve been keeping your eyes on the <a title="Virtualization EcoShell" href="http://www.thevesi.org/index.jspa" target="_blank">Virtualization EcoShell</a> project as well as <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>, you may have already come across this PowerPack because I released it there first.</p>
<p>The <a title="Advanced Reporting PowerPack" href="http://powergui.org/entry.jspa?categoryID=21&amp;externalID=2423" target="_blank">Advanced Reporting PowerPack</a> allows you to generate HTML reports with collapsible nested groups for any set of data in PowerGUI.  Think VMs, Snapshots, AD Users or Groups…you name it.  If you can get the data into a grid in <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>, you can generate a nice HTML report using this PowerPack.  The only UI element this PowerPack adds to <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> is a common action called “Create report…”.  This action does all of the heavy lifting to generate a cool HTML report for the items you have selected.</p>
<p>Want to see what how to get started using this PowerPack?  Watch this screencast:</p>
<p><span style="text-align:center; display: block;"><a href="http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/"><img src="http://img.youtube.com/vi/wkAxbALtELw/2.jpg" alt="" /></a></span></p>
<p>If you would prefer to watch a higher resolution version, you can watch the screencast in flash format <a title="Getting started with the Advanced Reporting PowerPack" href="http://powergui.org/shares/powergui/sbin/docs/Advanced_Reporting_PowerPack/Advanced_Reporting_PowerPack.html" target="_blank">here</a>.</p>
<p>This is only the first release of advanced reporting functionality in <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> and already it’s really powerful.  Still, there is room for improvement so if you have any feedback, please share it with me in my comments or on the <a title="PowerGUI forums" href="http://www.powergui.org/forumindex.jspa?categoryID=55" target="_blank">PowerGUI Forums</a> so that I can consider it for the next release!</p>
<p>Thanks and enjoy!</p>
<p>Kirk out.</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b42105c0-6b73-4add-af1f-06a1984bb8cb" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/PowerShell">PowerShell</a>,<a rel="tag" href="http://technorati.com/tags/PoSh">PoSh</a>,<a rel="tag" href="http://technorati.com/tags/Poshoholic">Poshoholic</a>,<a rel="tag" href="http://technorati.com/tags/PowerGUI">PowerGUI</a>,<a rel="tag" href="http://technorati.com/tags/PowerPack">PowerPack</a>,<a rel="tag" href="http://technorati.com/tags/Advanced+Reporting">Advanced Reporting</a>,<a rel="tag" href="http://technorati.com/tags/HTML+Report">HTML Report</a></div>
<table border="0" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post:</td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;title=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;;title=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;title=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;title=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;ti=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;title=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;title=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;title=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/&amp;t=Just Released: Advanced Reporting PowerPack" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0" alt="" /></a></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/217/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=217&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/K7byIbQct8w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/06/20/just-released-advanced-reporting-powerpack/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/wkAxbALtELw/2.jpg" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Hanselminutes Show #162: PowerShell 2.0</title>
		<link>http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/</link>
		<comments>http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/#comments</comments>
		<pubDate>Tue, 19 May 2009 04:32:20 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Hanselminutes]]></category>
		<category><![CDATA[podcast]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/05/18/hanselminutes-show-162-powershell-2-0/</guid>
		<description><![CDATA[While I was at tech·ed 2009 last week I ran into Hal while he was waiting for Scott Hanselman to finish up a game of Rock Band so that he could participate in a session for Scott’s popular podcast, Hanselminutes.&#160; Hal asked me if I wanted to participate, to which I said absolutely yes, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=213&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>While I was at tech·ed 2009 last week I ran into <a title="Hal Rottenberg" href="http://halr9000.com" target="_blank">Hal</a> while he was waiting for <a title="Scott Hanselman" href="http://www.hanselman.com/blog/" target="_blank">Scott Hanselman</a> to finish up a game of Rock Band so that he could participate in a session for Scott’s popular podcast, <a title="Hanselminutes" href="http://www.hanselminutes.com/" target="_blank">Hanselminutes</a>.&#160; <a title="Hal Rottenberg" href="http://halr9000.com" target="_blank">Hal</a> asked me if I wanted to participate, to which I said absolutely yes, and the result is a 35 minute discussion with Hal, Scott and I about PowerShell 2.0.</p>
<p><a title="Hal Rottenberg" href="http://halr9000.com" target="_blank">Hal</a>’s an IT pro, and while I work with IT pros a lot these days I have a developer background, so we were able to speak to both sides of the fence and talk about why you should pay attention to PowerShell whether you’re a software developer or an IT pro.</p>
<p>That recording is now live, so if you want to hear it head over to <a title="Hanselminutes Show #162: PowerShell 2.0" href="http://www.hanselminutes.com/default.aspx?showID=180" target="_blank">Hanselminutes Show #162: PowerShell 2.0</a>, and let me know what you think afterwards.</p>
<p>Kirk out.</p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4e3c6286-6766-4ada-9cad-a101c201171d" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/podcast" rel="tag">podcast</a>,<a href="http://technorati.com/tags/Hanselminutes" rel="tag">Hanselminutes</a></div>
<p>   <span class="sbmLink"></span></p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;title=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;;title=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;title=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;title=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;ti=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;title=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;title=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;title=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/&amp;t=Hanselminutes Show #162: PowerShell 2.0" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
<p> </span><span class="sbmLink"></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/213/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=213&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/KS34i7QGNK4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/05/18/hanselminutes-show-162-powershell-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Create custom nodes easily with the Active Directory PowerPack and PowerGUI</title>
		<link>http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/</link>
		<comments>http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/#comments</comments>
		<pubDate>Fri, 08 May 2009 21:14:53 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[PowerPack]]></category>
		<category><![CDATA[Quest AD Cmdlets]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/</guid>
		<description><![CDATA[Here’s a great question that someone just posted today on the PowerGUI forums:
I have the latest verions of the Quest AD cmdlets, PowerGUI and the Active Directory PowerPack.  Can I use PowerGUI to search for old computer accounts?  For example: computer accounts that haven’t had their machine account password reset for over three months?
The timing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=208&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Here’s a great question that someone just posted today on the <a title="PowerGUI forums" href="http://www.powergui.org/forumindex.jspa?categoryID=55" target="_blank">PowerGUI forums</a>:</p>
<blockquote><p>I have the latest verions of the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a>, <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> and the <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a>.  Can I use <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> to search for old computer accounts?  For example: computer accounts that haven’t had their machine account password reset for over three months?</p></blockquote>
<p><span style="color:#000000;">The timing of this question is perfect because the update of the </span><a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank"><span style="color:#000000;">Active Directory PowerPack</span></a><span style="color:#000000;"> that I posted two weeks ago allows you to do this without having to write any scripts yourself.  For those of you who want to try this but don’t have the most recent versions of </span><a title="PowerGUI" href="http://www.powergui.org" target="_blank"><span style="color:#000000;">PowerGUI</span></a><span style="color:#000000;">, the </span><a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank"><span style="color:#000000;">Quest AD cmdlets</span></a><span style="color:#000000;"> and the </span><a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank"><span style="color:#000000;">Active Directory PowerPack</span></a><span style="color:#000000;"> installed, follow those links and download and install those before continuing.  Installation instructions are on the appropriate web pages where necessary.</span></p>
<p><span style="color:#000000;">Once you all of the necessary software installed, here’s what you need to do.</span></p>
<p><strong><span style="color:#000000;">Step 1: Add the attributes you need to the list of attributes retrieved from Active Directory.</span></strong></p>
<p>There are In the PowerGUI Admin Console, expand the “Active Directory” node and click on “Configuration”.  This will show you the current domain that PowerGUI will gather data from.  You can change this if you like, however you don’t need to unless you want to use alternate credentials or connect to another domain.  With the configuration showing in the grid, click on the “Manage default attributes” link.  That will present you with a view something like this:</p>
<p><a href="http://kirkmunro.files.wordpress.com/2009/05/image.png" target="_blank"><img style="display:inline;border-width:0;" title="image" src="http://kirkmunro.files.wordpress.com/2009/05/image_thumb.png?w=412&#038;h=247" border="0" alt="image" width="412" height="247" /></a></p>
<p>This shows you the current list of attributes that are retrieved for each individual Active Directory object.  This will be initially configured with the default attributes as defined by the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> plus a few attributes that are required for the <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a>.  You can add whatever attributes you want to gather here for any of the object types.  To help solve our immediate problem and be able to get a list of computer accounts that have not had their machine account password reset for over three months, we need to add the pwdLastSet attribute for computer objects.  To do this, simply click on the “Add attribute…” action, provide the name of the pwdLastSet attribute in the “Attribute name” field and set the “Retrieve attribute for computer objects” value to True.  When you click on OK, that attribute configuration will be saved and any computer objects retrieved using the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> will have that attribute retrieved with them.</p>
<p><strong>Step 2: Retrieve the objects you want from Active Directory and optionally show the attributes you want to filter on.</strong></p>
<p>Once you have configured PowerGUI so that it will retrieve the pwdLastSet attribute for computer objects, you need to get your computers.  You can do this by simply clicking on the “Computers” child node under the “Active Directory” node.  This will present you with a list of computer accounts, showing their Name, Type and DN by default.</p>
<p>With the list of computer objects showing, you can optionally add the pwdLastSet attribute to the view by right-clicking in the column headers and selecting “More…” from the menu that appears.  With the list of all attributes that can be added showing, scroll down until you find the pwdLastSet attribute and check the checkbox beside it.  Then click on OK to save that change and your pwdLastSet attribute will be retrieved with your computer objects from the Computers node.</p>
<p><strong>Step 3: Create a client-side filter to filter out the objects you don’t care about.</strong></p>
<p>With the list of all of your computer objects showing, you can create a filter to reduce the number of objects to those that you need to see.  To do this, click on the Filters button above the column headers.  This will make the filter panel visible.</p>
<p><a href="http://kirkmunro.files.wordpress.com/2009/05/image1.png" target="_blank"><img style="display:inline;border-width:0;" title="image" src="http://kirkmunro.files.wordpress.com/2009/05/image_thumb1.png?w=412&#038;h=247" border="0" alt="image" width="412" height="247" /></a></p>
<p>You can use this panel to filter any collection based on the properties of the objects in that collection.  For our particular problem, we want to see computer objects whose password has not been changed in the last 3 months.  We can get that by selecting “pwdLastSet” in the “Property” field, “Less or equal” in the “Operator” field, and selecting the calendar date three months ago in the “Value” field using the calendar control.  Once that is set, click on the “Apply” button to apply the filter and your list of computer objects will be filtered to only show those whose machine passwords haven’t changed in the last 3 months.</p>
<p><strong>Step 4: Make the newly filtered data set available in its own node.</strong></p>
<p>Now that you have the data you’re looking after, your “Computers” node is now configured to always show you the filtered list because PowerGUI remembers the filters you apply to nodes.  You might not like this configuration, preferring to have a separate node to view the data that you want.  Fortunately, PowerGUI lets you do create that easily too, and you still don’t have to do any scripting.  To create a separate node that lets you get the same data set, simply click on the “Save As…” button in the filter panel.  This will allow you to save the script from the Computers node with the filter you have created automatically applied as a client-side filter for that script.  Simply give the new script node a name (something intuitive like “Computers with old passwords” will do), and click on OK to save the new child node.  Then you can click on the “Clear All” button in the filter panel for your “Computers” node because that filter will no longer be needed.  Now click on your new node and you’ll get the list of computers you are after, and it will look something like the screenshot below.</p>
<p><a href="http://kirkmunro.files.wordpress.com/2009/05/image2.png" target="_blank"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" src="http://kirkmunro.files.wordpress.com/2009/05/image_thumb2.png?w=415&#038;h=249" border="0" alt="image" width="415" height="249" /></a></p>
<p><strong>Step 5: Make your work reusable at any time by taking it one step further.</strong></p>
<p>At this point you have successfully created a new node that gets specifically the data you were looking for and you didn’t have to do any scripting to get it, which is great!  You can make it a little better still though.  For our specific problem that we’re trying to solve, we created a new node that reports any computer object with a machine account password that hasn’t been changed within 3 months from today.  But tomorrow that will be come 3 months and 1 day.  The next day that will become 3 months and 2 days.  What if you want to customize the node so that it reports computers whose machine accounts have not had their passwords changed in the last 3 months, no matter what day you click on it?  For that to work you will have to do a minor script modification.</p>
<p>Right-click on your new “Computers with old passwords” node and select properties.  This will show you the script used to retrieve your computers and filter the list.  At the very end of that script, you will see something like the following:</p>
<pre><span style="color:#000000;"><span style="color:#5f9ea0;">func_Computers</span> | </span><span style="color:#5f9ea0;font-weight:bold;">Where-Object</span><span style="color:#000000;"> {
    </span><span style="color:#000080;">$_</span><span style="color:#000000;">.</span><span style="color:#800000;">'</span><span style="color:#800000;">pwdlastset</span><span style="color:#800000;">' </span><span style="color:#ff0000;">-le</span><span style="color:#000000;"> [</span><span style="color:#008080;">System.DateTime</span><span style="color:#000000;">]</span><span style="color:#800000;">"</span><span style="color:#800000;">2009-02-08</span><span style="color:#800000;">"
</span><span style="color:#000000;">}</span></pre>
<p>The Where-Object cmdlet contains the filter that is excluding any computers whose pwdLastSet attribute is greater than 3 months from the day we did this (for me that that’s February 8, 2009 since I created the node on May 8, 2009).  To change that filter so that it always works using a date 3 months earlier than now, you simply need to replace [System.DateTime]”2009-02-08” with (Get-Date).AddMonths(-3).  That changes the end of our script to this:</p>
<pre><span style="color:#000000;"><span style="color:#5f9ea0;">func_Computers</span> | </span><span style="color:#5f9ea0;font-weight:bold;">Where-Object</span><span style="color:#000000;"> {
    </span><span style="color:#000080;">$_</span><span style="color:#000000;">.</span><span style="color:#800000;">'</span><span style="color:#800000;">pwdlastset</span><span style="color:#800000;">'</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-le</span><span style="color:#000000;"> (</span><span style="color:#5f9ea0;font-weight:bold;">Get-Date</span><span style="color:#000000;">).AddMonths(</span><span style="color:#ff0000;">-</span><span style="color:#000000;">3</span><span style="color:#000000;">)
}</span></pre>
<p>That’s it!  A simple replacement of the filter condition and you’re off and running with a brand new node designed to meet your specific needs with <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>, the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> and the <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a>!</p>
<p>In a future article I’ll show you just how simple it is for you to take a collection of extensions to PowerPacks that you have created like this and package them up in a PowerPack so that you can share them with other users in the Community as well!</p>
<p>Enjoy!</p>
<p>Kirk out.</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:40829a14-fe8c-4b6b-8f3d-7284d2342eef" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/PowerShell">PowerShell</a>,<a rel="tag" href="http://technorati.com/tags/PoSh">PoSh</a>,<a rel="tag" href="http://technorati.com/tags/Poshoholic">Poshoholic</a>,<a rel="tag" href="http://technorati.com/tags/PowerGUI">PowerGUI</a>,<a rel="tag" href="http://technorati.com/tags/PowerPack">PowerPack</a>,<a rel="tag" href="http://technorati.com/tags/Active+Directory">Active Directory</a>,<a rel="tag" href="http://technorati.com/tags/Quest+AD+Cmdlets">Quest AD Cmdlets</a></div>
<p> </p>
<table border="0" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post:</td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;title=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;;title=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;title=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;title=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;ti=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;title=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;title=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;title=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0" alt="" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/&amp;t=Create custom nodes easily with the Active Directory PowerPack and PowerGUI" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0" alt="" /></a></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/208/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=208&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/SPF69TNM9Cc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/05/08/create-custom-nodes-easily-with-the-active-directory-powerpack-and-powergui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2009/05/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2009/05/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2009/05/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell</title>
		<link>http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/</link>
		<comments>http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/#comments</comments>
		<pubDate>Fri, 01 May 2009 23:23:52 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Quest AD Cmdlets]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[breaking changes]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/</guid>
		<description><![CDATA[This is about what can happen when things go wrong and what not to do so that things don’t go wrong.
In case you didn’t know, I work at Quest Software on the PowerGUI Team.&#160; My position is rather unique because I work exclusively with Windows PowerShell, and I don’t think there are too many jobs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=199&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is about what can happen when things go wrong and what not to do so that things don’t go wrong.</p>
<p>In case you didn’t know, I work at Quest Software on the <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> Team.&#160; My position is rather unique because I work exclusively with Windows PowerShell, and I don’t think there are too many jobs out there that offer that experience.&#160; The main focus of my job is to create and extend PowerPacks, which are collections of PowerShell scripts that are packaged together to define an extension to the customizable <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> Admin Console.&#160; The scripts in the PowerPacks I create range anywhere from the extremely simple (one cmdlet or function call) to the very complicated (a script that calls into one or more functions that span many thousands of lines of PowerShell script).</p>
<p>Among others, one of the PowerPacks that I manage is the <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a>.&#160; The <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a> provides a management interface to Active Directory, and it uses the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> in its PowerShell scripts to do the actual management of Active Directory.&#160; For quite a few reasons<sup>1</sup>,&#160; I need to explicitly indicate which connection should be used when you use that PowerPack to do something with Active Directory, regardless of what it is you are doing.&#160; This means I am absolutely dependent on being able to determine what connection should be used in any script that is included in the PowerPack.&#160; For scripts that are used at the beginning of a pipeline I look for the appropriate connection information that is stored globally.&#160; For other scripts that are used later in a pipeline with <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> I look at the Connection property that is attached to the objects coming down the pipeline.&#160; This model has worked very well until recently when something unexpected happened.</p>
<p>Almost two weeks ago, just after version 1.2 of the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> was released, it came to my attention that the Connection property that I am so dependent on was not included on objects in that release.&#160; For those of you who are not developers, this type of change (changing a public interface in an SDK) is very bad news.&#160; It is called a breaking change, and the name is very fitting – the <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a> started breaking all over the place for users who upgraded their <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> to version 1.2!<img title="" border="0" alt="" src="http://powergui.org/images/emoticons/sad.gif" /></p>
<p>Amid a flurry of email discussions between myself and the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> team I spent the next week and a bit putting together an update to the <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a> so that it would work despite these changes, basically putting the Connection property there myself if it isn’t there.&#160; At the same time, the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> team quickly started work on a 1.2.1 patch release to put the Connection property back in so that scripts outside of <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> that use that property wouldn’t be affected either.&#160; The patch for the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> is not available yet, but the updated <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a>, and the updated <a title="Network PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=48&amp;externalID=2363" target="_blank">Network PowerPack</a> which also used the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> a fair amount and was therefore susceptible to this change, are now posted in the <a title="PowerPack Library" href="http://www.powergui.org/kbcategory.jspa?categoryID=21" target="_blank">PowerPack library</a> and available for download.&#160; If you use these PowerPacks, I strongly recommend you download and import the most recent releases of each of these PowerPacks.&#160; Their document page in the <a title="PowerPack Library" href="http://www.powergui.org/kbcategory.jspa?categoryID=21" target="_blank">PowerPack library</a> contains all of the information you need to upgrade your PowerPacks and get started using the new versions.</p>
<p>Now that I have finished dealing with the impact of a breaking change like this one and the unpleasant work that ensues,&#160; I thought it would be worthwhile to share with others what exactly consititutes a breaking change in a PowerShell cmdlet or advanced function.&#160; The following is a list of 13 rules that you should adhere to when updating your cmdlets or advanced functions if you want to avoid introducing breaking changes:</p>
<ol>
<li>Do not remove any published parameters that are included in your published cmdlets or advanced functions. </li>
<li>Do not rename any published parameters that are included in your published cmdlets or advanced functions unless you add an alias to the parameter that is the old parameter name. </li>
<li>Do not reduce or remove pipeline support for any published parameters in your published cmdlets or advanced functions that support pipeline input. </li>
<li>Do not remove support for $null input for any published parameters in your published cmdlets or advanced functions that support $null input. </li>
<li>Do not modify the default value for any published parameters in your published cmdlets or advanced functions unless that modification will not change how the command functions in existing scripts. </li>
<li>Do not add a required flag to any parameter in published parameter sets in your published cmdlets or advanced functions. </li>
<li>Do not modify the position of any published parameters in published parameter sets in your published cmdlets or advanced functions. </li>
<li>Do not replace the associated object type with an incompatible type for any published parameters in your published cmdlets or advanced functions. </li>
<li>Do not remove wildcard support for any published parameters in your published cmdlets or advanced functions that have wildcard support. </li>
<li>Do not remove support for building the value from the remaining arguments in any published parameters in your published cmdlets or advanced functions that support building the value in this manner. </li>
<li>Do not remove any of your published parameters from published parameter sets in your published cmdlets or advanced functions. </li>
<li>Do not increase validation restrictions for any of your published parameters in your published cmdlets or advanced functions that have validation restrictions. </li>
<li>Do not modify or remove aliases for any published parameters in your published cmdlets or advanced functions. </li>
</ol>
<p>Additionally you need to pay attention to the objects that are returned by your cmdlets or advanced functions so that you don’t introduce breaking changes on those either.&#160; The following rules should be adhered to in order to avoid breaking changes on objects returned by your cmdlets or advanced functions:</p>
<ol>
<li>Do not remove a public property or method. </li>
<li>Do not replace the types associated with a public property or method with incompatible types. </li>
<li>Do not modify the order of the parameters in a public method. </li>
<li>Do not add required parameters in a public method. </li>
</ol>
<p>Not following these rules means risking breaking production scripts, risking making your customers unhappy, and many other potential undesirable consequences.&#160; Please, if you are seriously trying to add value to the PowerShell ecosystem by extending it with additional commands, pay attention to these rules and don’t introduce breaking changes when you update them!</p>
<p>Thanks for listening!</p>
<p>Kirk out.</p>
<table border="0" cellspacing="0" cellpadding="2" width="433">
<tbody>
<tr>
<td valign="top" width="10"><sup>1</sup></td>
<td valign="top" width="422">Reasons why the connection must be explicitly indicated in the <a title="Active Directory PowerPack" href="http://www.powergui.org/entry.jspa?categoryID=46&amp;externalID=763" target="_blank">Active Directory PowerPack</a>:</td>
</tr>
<tr>
<td valign="top" width="10"></td>
<td valign="top" width="421">
<table border="0" cellspacing="0" cellpadding="2" width="409">
<tbody>
<tr>
<td valign="top" width="10">1.</td>
<td valign="top" width="397">The <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> allow you to connect to many different directory services.</td>
</tr>
<tr>
<td valign="top" width="10">2.</td>
<td valign="top" width="397">Opening a connection to a directory service with the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> changes a global variable that is used automatically by other cmdlets in the same snapin when you don’t explicitly indicate what connection to use.</td>
</tr>
<tr>
<td valign="top" width="10">3.</td>
<td valign="top" width="397">In <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> you can create or import other PowerPacks that may open their own connections to different directory services using the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a>, Active Directory or otherwise.</td>
</tr>
<tr>
<td valign="top" width="10">4.</td>
<td valign="top" width="397">In PowerShell, whether you are using the <a title="Quest AD cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD cmdlets</a> interactively or invoking a script that uses them, you are likely only working with one set of data from one directory service at a time in a logical manner.&#160; Working in a user interface that is built on top of PowerShell is less restrictive, allowing you to move more freely between multiple data sets from multiple sources (directory services in this case) in what would be considered an illogical manner as far as script creation goes.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p> 
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a4f41384-3e7d-4870-b9ea-056a762af607" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Active+Directory" rel="tag">Active Directory</a>,<a href="http://technorati.com/tags/Quest+AD+Cmdlets" rel="tag">Quest AD Cmdlets</a>,<a href="http://technorati.com/tags/scripting" rel="tag">scripting</a>,<a href="http://technorati.com/tags/breaking+changes" rel="tag">breaking changes</a></div>
</p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;title=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;;title=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;title=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;title=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;ti=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;title=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;title=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;title=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/&amp;t=The Active Directory PowerPack, the Quest AD cmdlets, and what can happen when you change public object interfaces or cmdlet parameter attributes in PowerShell" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
<p> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/199/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=199&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/zr_LRIOmWUI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/05/01/the-active-directory-powerpack-the-quest-ad-cmdlets-and-what-can-happen-when-you-change-public-object-interfaces-or-cmdlet-parameter-attributes-in-powershell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://powergui.org/images/emoticons/sad.gif" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Virtualization EcoShell and the VMware Infrastructure PowerPack</title>
		<link>http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/</link>
		<comments>http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 22:01:10 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerPack]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Virtualization EcoShell]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VI Toolkit]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/</guid>
		<description><![CDATA[Wow, have I been busy.&#160; In case you hadn’t noticed from my blog posts late last year and early this year, I’ve been working very hard at putting together multiple back-to-back updates for the VMware Infrastructure Management PowerPack for the past several months.&#160; This has involved working long hours with many thousands of lines of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=196&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Wow, have I been busy.&#160; In case you hadn’t noticed from my blog posts late last year and early this year, I’ve been working very hard at putting together multiple back-to-back updates for the <a title="VMware Infrastructure Management PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a> for the past several months.&#160; This has involved working long hours with many thousands of lines of PowerShell script and figuring out how to do some really cool things with both PowerShell and <a title="VMware&#39;s PowerCLI" href="http://blogs.vmware.com/vipowershell/" target="_blank">VMware’s PowerCLI</a> (formerly known as the <a title="VMware&#39;s PowerCLI (formerly known as the VI Toolkit)" href="http://blogs.vmware.com/vipowershell/" target="_blank">VI Toolkit</a>).&#160; The end result is always fulfulling, and I’m usually pretty good at setting up the really cool functionality so that I can leverage it in any PowerPack so all my hard work pays off in the long run.</p>
<p>A few weeks ago I finished off yet another update with some really cool new features, however this update isn’t available for the <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> admin console just yet.&#160; That update is coming shortly after we release the next version of <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>, which has some functionality that it is dependent on.&#160; If you can’t wait until then though, you can take a look at the new functionality now as part of the first public beta release of the <a title="Virtualization EcoShell" href="http://www.thevesi.org/index.jspa" target="_blank">Virtualization EcoShell</a> that came out on April 15th.</p>
<p>What is the <a title="Virtualization EcoShell" href="http://www.thevesi.org/index.jspa" target="_blank">Virtualization EcoShell</a>?&#160; The <a title="Virtualization EcoShell" href="http://www.thevesi.org/index.jspa" target="_blank">Virtualization EcoShell</a> is a project started by <a title="Scott Herold - VM Guru" href="http://vmguru.com/" target="_blank">Scott Herold</a> that was designed to provide an administrative experience that is tailored for virtualization administrators.&#160; It is powered by <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> and comes with a script editor and an admin console just like <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>.&#160; The out of the box experience is different though because it doesn’t come with PowerPacks for Exchange and Active Directory.&#160; Instead it includes functionality that virtualization administrators care most about.&#160; At the moment this is simply the <a title="VMware Infrastructure Management PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a>, but over time this will grow to include other virtualization-related administrative functionality (think: additional VMware features, functionality to work with virtualization platforms from other vendors, and capabilities to extend into important technologies surrounding virtualization such as storage).</p>
<p>If you want a preview of the next generation of the <a title="VMware Infrastructure Management PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a> a little early as well as a look at a new virtualization administration platform, all you have to do is pop over to the <a title="Virtualization EcoShell" href="http://www.thevesi.org/index.jspa" target="_blank">Virtualization EcoShell</a> site and download it.&#160; You can install and use it side-by-side with <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>, so you won’t need any secondary systems or a VM to run it on either.&#160; Once you’ve taken a look, let us know what you think or what you would like to see next on the <a title="Virtualization EcoShell Forums" href="http://www.thevesi.org/forumindex.jspa?categoryID=628" target="_blank">forums</a>!&#160; Your feedback directly influences the features we add, and we’re listening!</p>
<p>Kirk out.</p>
<p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2af846e0-f621-4d28-a68e-403be8094a37" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/Virtualization+EcoShell" rel="tag">Virtualization EcoShell</a>,<a href="http://technorati.com/tags/VMware" rel="tag">VMware</a>,<a href="http://technorati.com/tags/PowerPack" rel="tag">PowerPack</a>,<a href="http://technorati.com/tags/virtualization" rel="tag">virtualization</a>,<a href="http://technorati.com/tags/VI+Toolkit" rel="tag">VI Toolkit</a>,<a href="http://technorati.com/tags/PowerCLI" rel="tag">PowerCLI</a></div>
</p>
<p> <span class="sbmLink"><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;title=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;;title=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;title=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;title=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;ti=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;title=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;title=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;title=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/&amp;t=Virtualization EcoShell and the VMware Infrastructure PowerPack" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
<p>   </span></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=196&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/VmP6maqUKDI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/04/28/virtualization-ecoshell-and-the-vmware-infrastructure-powerpack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>VMware Infrastructure PowerPack 2.1.5 released</title>
		<link>http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/</link>
		<comments>http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 05:14:39 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[ESX]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[PowerPack]]></category>
		<category><![CDATA[VI Toolkit]]></category>
		<category><![CDATA[Virtual Center]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[Visio]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/</guid>
		<description><![CDATA[The PowerGUI&#160;VMware Infrastructure Management PowerPack seems to be really popular with people, so I’ve been spending a lot of time over the past four months significantly enhancing that PowerPack.&#160; Some of the enhancements are things that we wanted to put in and others are things that community members had requested (note to the reader: if [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=190&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>&#160;<a title="VMware PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a> seems to be really popular with people, so I’ve been spending a lot of time over the past four months significantly enhancing that PowerPack.&#160; Some of the enhancements are things that we wanted to put in and others are things that community members had requested (note to the reader: if you like a particular PowerPack and would like to see it improved, speak up on the <a title="PowerGUI Forums" href="http://www.powergui.org/forumindex.jspa?categoryID=55" target="_blank">PowerGUI Forums</a>…we really take your feedback very seriously! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).&#160; Today I just finished posting another release of the <a title="VMware PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a> with a few more enhancements, and I’m particularly happy with this one.</p>
<p>This release greatly improves usability through the new icons that were added (and I mean *greatly* improves…the value the icons add is huge).&#160; It’s also the first PowerPack release that takes advantage of some really cool Visio scripts that I’ve been working on.&#160; The Visio scripts I’m referring to were largely inspired by <a title="vDiagram - Draw your VI with one script" href="http://www.virtu-al.net/2009/01/26/vdiagram-draw-your-vi-with-one-script/" target="_blank">Alan Renouf’s vDiagram script</a>, although the Visio script I ended up with doesn’t look anything like the original.&#160; I’m itching to talk more about those scripts, but I want to write a blog post specifically on that topic so watch for more on this soon.&#160; For now I’ll simply point out that to use the Visio functionality, you have to download the additional <a title="VESI_Visio" href="http://www.powergui.org/servlet/KbServlet/download/1802-102-3396/VESI_Visio.zip" target="_blank">VESI_Visio.zip</a> file that was added to the <a title="VMware PowerPack document page" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=21" target="_blank">VMware Infrastructure Management PowerPack document page</a> and install it as per the instructions in that document (see the “How to enable vDiagram support” section).&#160; Visio 2007 is required.</p>
<p>For those of you who were fortunate enough to attend VMworld Europe in Cannes at the end of February, this release contains the icons and Visio features that <a title="Scott Herold - VM Guru" href="http://vmguru.com/" target="_blank">Scott Herold</a> was showing off during that show.&#160; You can see a live demo of the new features on Scott’s website, <a title="VESI Demonstration - Bootleg Edition" href="http://vmguru.com/index.php/articles-mainmenu-62/scripting/89-vesi-demonstration-bootleg-edition" target="_blank">here</a>.</p>
<p>If you want to learn more about this PowerPack, including version history and other details, you can go <a title="VMware Infrastructure Management PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">here</a>.&#160; You can download the PowerPack from that location as well.</p>
<p>Kirk out.</p>
</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:21dba1f9-4a01-49aa-8eb4-cea0ec04e858" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/VMware" rel="tag">VMware</a>,<a href="http://technorati.com/tags/PowerPack" rel="tag">PowerPack</a>,<a href="http://technorati.com/tags/Virtual+Center" rel="tag">Virtual Center</a>,<a href="http://technorati.com/tags/ESX" rel="tag">ESX</a>,<a href="http://technorati.com/tags/virtualization" rel="tag">virtualization</a>,<a href="http://technorati.com/tags/VI+Toolkit" rel="tag">VI Toolkit</a>,<a href="http://technorati.com/tags/Visio" rel="tag">Visio</a></div>
</p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;title=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;;title=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;title=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;title=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;ti=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;title=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;title=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;title=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/&amp;t=VMware Infrastructure PowerPack 2.1.5 released" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
<p> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/190/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=190&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/z1Ncz2yn95E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/03/09/vmware-infrastructure-powerpack-2-1-5-released/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation</title>
		<link>http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/</link>
		<comments>http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 17:55:03 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Deep Dive]]></category>
		<category><![CDATA[Get-Alias]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[string evaluation]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/</guid>
		<description><![CDATA[The following question recently came up on a mailing list I follow:
When I am trying to get the definition for the alias &#34;?&#34;, I need to escape it because if not it works like a wildcard.&#160; That is ok.
But why do I have to use SINGLE quotes, and why do DOUBLE quotes fail to escape?&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=182&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The following question recently came up on a mailing list I follow:</p>
<blockquote><p><font color="#333333">When I am trying to get the definition for the alias &quot;?&quot;, I need to escape it because if not it works like a wildcard.&#160; That is ok.</font></p>
<p><font color="#333333">But why do I have to use SINGLE quotes, and why do DOUBLE quotes fail to escape?&#160; I thought it should be the other way around.</font></p>
<p><font color="#333333">For example, this works:</font></p>
<p><font color="#333333">Get-Alias &#8216;`?&#8217;</font></p>
<p><font color="#333333">This does not work:</font></p>
<p><font color="#333333">Get-Alias &quot;`?&quot;</font></p>
<p><font color="#333333">Why?</font></p>
</blockquote>
<p>This question was prompted by Aleksandar’s <a title="Get-Alias" href="http://powershellers.blogspot.com/2009/02/get-alias.html" target="_blank">blog post about the problem</a>.&#160; There are quite a few things to consider here to understand what is going on.</p>
<p>First, as the author of the question pointed out, in the Get-Alias cmdlet the question mark character is a wildcard character.&#160; That means if you simply call Get-Alias with a question mark (Get-Alias ?), you will get all one-character aliases because the question mark will match any character.&#160; That will happen regardless of whether you use single quotes, double quotes, or no quotes.&#160; So the question mark must be escaped to tell Get-Alias to treat it as an actual question mark, and not a wildcard question mark.</p>
<p>Second, in PowerShell a single-quoted string is a literal string, so characters are taken as is.&#160; A double-quoted string is a special string where the contents are evaluated to determine what the actual string is (see Get-Help about_quoting_rules for more details).&#160; In a double-quoted string, any variables or subexpressions (identified by their prefix of $) are evaluated and the results are placed in the string.&#160; Also, any escaped characters are evaluated and the results are placed in the string.&#160; The standard way to escape a character is to precede it with a backtick (`).</p>
<p>Third, if you escape any non-escape character by preceding it with a backtick, the result is simply that non-escape character.&#160; The backtick is discarded.</p>
<p>Fourth, there is a difference between escaping escape characters when evaluating a double-quoted string and escaping wildcard characters in cmdlet that accept strings containing wildcards.&#160; Both are escaped the same way, but understanding the timing of their evaluation and knowing what characters they consider to be escape characters is very important.&#160; Double-quoted string evaluation happens outside of a cmdlet, before it is called.&#160; Wildcard string evaluation happens inside of a cmdlet, once it is called.</p>
<p>And lastly, Get-Alias works just like the Path parameter set variant of Get-Item (that is to say, it works just like Get-Item when you call Get-Item with the Path parameter), returning multiple results when unescaped wildcard characters are in the search string and there are multiple matching aliases.&#160; Get-Alias is a little simpler to use on a general basis, but if it wasn’t there you could just use Get-Item instead.</p>
<p>Now that we’re armed with that knowledge, lets break down the command we’re having a hard time with.</p>
<blockquote><p><font color="#333333">Get-Alias &quot;`?&quot;</font></p>
</blockquote>
<p>Here are the results of that command in PowerShell:</p>
<p><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="188" alt="image" src="http://kirkmunro.files.wordpress.com/2009/02/image4.png?w=425&#038;h=188" width="425" border="0" /> </p>
<p>What’s happening here?&#160; When this command is executed, the first thing PowerShell has to do is evaluate the double-quoted string and get the result string that comes out of that evaluation, before the cmdlet is called.&#160; As I explained above, any non-escape character that is escaped in a double-quoted string is simply evaluated as the non-escape character.&#160; In our string, the question mark is being escaped, but that isn’t an escape character when it comes to string parsing (use the command Get-Help about_escape_character to get the list of escape characters in double-quoted strings), so the result of the evaluation is simply &#8216;?&#8217;.&#160; When that string is then passed to Get-Alias, the Get-Alias cmdlet thinks we’re looking for any single-character aliases, so that’s what it gives us in the output.</p>
<p>What we need to do is make sure that the results of the evaluation of the double-quoted string are such that the question mark is preceded by a backtick so that it is escaped when it is passed into the Get-Alias cmdlet (string evaluation timing is important, remember?).&#160; To do that, we need to know how to generate a single backtick in the result returned from a double-quoted string evaluation.&#160; The backtick is an escape character itself as well as the character used to escape other characters (we learned this when we looked at the about_escape_character helpfile, mentioned earlier), so we can create a backtick in a double-quoted string by escaping it with itself, like this: &quot;&#8220;&quot;.</p>
<p>Now that we know how to escape the backtick so that it is passed into the Get-Alias cmdlet, we can change our problematic command we were using by escaping the backtick in the double-quotes and get the results we wanted in the first place:</p>
<p><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="152" alt="image" src="http://kirkmunro.files.wordpress.com/2009/02/image5.png?w=425&#038;h=152" width="425" border="0" /> </p>
<p>It is important to note that a non-quoted string is treated as a double-quoted string in PowerShell when it is evaluating a command that it is about to run, so if you wanted to do this without quotes at all, you would still have to escape the backtick, like this:</p>
<p><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="152" alt="image" src="http://kirkmunro.files.wordpress.com/2009/02/image6.png?w=425&#038;h=152" width="425" border="0" /> </p>
<p>The last thought I want to leave you with is about Get-Item.&#160; I mentioned earlier that Get-Alias works just like the Path parameter set variant of Get-Item.&#160; Both of these need to have wildcard characters escaped if you want to find an alias that contains a wildcard character.&#160; What I didn’t mention is that Get-Item has something that Get-Alias does not: a LiteralPath parameter set variant.&#160; The easiest way to retrieve an alias containing a wildcard without worrying about escaping any characters is to simply use Get-Item with the alias PSDrive, like this:</p>
<p><img title="image" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="152" alt="image" src="http://kirkmunro.files.wordpress.com/2009/02/image7.png?w=425&#038;h=152" width="425" border="0" />&#160;</p>
<p>This method requires the use of the LiteralPath parameter name and the alias PSDrive name, but it gives you exactly what you want, without having to worry about most of what I tried to show you here, and it’s easy.&#160; Still, I had to show you the details first…a solid foundation in understanding how these things work goes a long way when writing and troubleshooting PowerShell scripts.&#160; If you want it even easier, you could create a simple Get-LiteralAlias function that removes the need to use the Alias PSDrive name and calls Get-Item using the LiteralPath parameter set variant behind the scenes.&#160; You could also create a Get-Alias function that has a Literal switch parameter so that you could simply indicate whether you wanted to call Get-Alias or Get-LiteralPath behind the scenes.&#160; With PowerShell, there are definitely no shortage of options when you don’t have the functionality you are looking for the way you expect it to be there.&#160; I’ll leave the exercise of creating the functions up to you, if you think it’s worth it (after all, there is only one default alias with a wildcard character in its name).</p>
<p>Armed with all of this knowledge, it becomes completely obvious why an unusual alias created with the New-Alias command (which doesn’t support wildcard characters) like this:</p>
<blockquote><p>$foo = &#8216;bar&#8217;     <br />New-Alias &quot;&#8220;?$foo&quot; &#8216;bar&#8217;</p>
</blockquote>
<p>can be retrieved using either of the following Get-Alias commands:</p>
<blockquote><p>Get-Alias &quot;&#8220;&#8220;?$foo&quot;     <br />Get-Alias &quot;&#8220;&#8220;`?$foo&quot;</p>
</blockquote>
<p>Right? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Kirk out.</p>
<p>
<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e9c6d4c4-3ce1-492e-b8db-987013dac46e" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerShell+Deep+Dive" rel="tag">PowerShell Deep Dive</a>,<a href="http://technorati.com/tags/Get-Alias" rel="tag">Get-Alias</a>,<a href="http://technorati.com/tags/string+evaluation" rel="tag">string evaluation</a></div>
</p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;title=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;;title=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;title=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;title=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;ti=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;title=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;title=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;title=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/&amp;t=PowerShell Deep Dive: Understanding Get-Alias, wildcards, escape characters, quoting rules, literal vs. non-literal paths, and the timing of string evaluation" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0" /></a></td>
</tr>
</tbody>
</table>
<p> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=182&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/R3X2XqZ6hL0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/02/18/powershell-deep-dive-understanding-get-alias-wildcards-escape-characters-quoting-rules-literal-vs-non-literal-paths-and-the-timing-of-string-evaluation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2009/02/image4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2009/02/image5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2009/02/image6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2009/02/image7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files</title>
		<link>http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/</link>
		<comments>http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 20:59:25 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Quick Tip]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[ps1]]></category>
		<category><![CDATA[Quick Tip]]></category>
		<category><![CDATA[script file]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/</guid>
		<description><![CDATA[I was just reading Steve Murawski’s latest blog post which contains a script called ConvertTo-Function that allows you to generate a function from a script file.&#160; The intent is to allow you to have scripts you don’t call as often, and therefore don’t load into your profile, but when you need them you can use [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=172&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was just reading <a title="Steve Murawski" href="http://blog.usepowershell.com/" target="_blank">Steve Murawski</a>’s <a title="ConvertTo-Function" href="http://blog.usepowershell.com/2009/02/convertto-function/" target="_blank">latest blog post</a> which contains a script called ConvertTo-Function that allows you to generate a function from a script file.&#160; The intent is to allow you to have scripts you don’t call as often, and therefore don’t load into your profile, but when you need them you can use this script to easily generate functions that wrap them so that you don’t need to think about the path beyond the initial call to the ConvertTo-Function script.&#160; That’s one way to facilitate this, but I have something I use quite commonly in my own environment that works much better for me for this scenario: aliases.</p>
<p>Aliases can reference a path to a script file.</p>
<p>This capability is often overlooked because aliases are most commonly used and thought of as terse command names.&#160; Using them to reference a path to a script file is quite useful because it allows you to keep all of your scripts, complete or in development, in a common location.&#160; You can control which ones are loaded in your profile by only creating aliases for those scripts.&#160; Alternatively, for scripts that you really don’t use very often, you could have a function in your profile to create the aliases to those scripts on an as needed basis (which sounds a little like the Add-Module capabilities in PowerShell v2).&#160; In either case, using aliases to reference script files is very handy because you don’t need to worry about whether the scripts you want to invoke are in a folder in your path environment variable or not.&#160; You simply need to create an alias to the full path and then you can use that alias to invoke your script.</p>
<p>For example, assuming you had a script with the path C:\MyScripts\Miscellaneous\Do-Something.ps1, you could invoke it using the absolute or relative path, or if C:\MyScripts\Miscellaneous happened to be in your path environment variable you could simply invoke it using the Do-Something command.&#160; But if you don’t have your script path in your path environment variable and/or you don’t want to change that variable, aliases give you the same capability on a temporary basis for your current PowerShell session (and only in your current scope by default if you want it really temporary).&#160; Using our example script path, all you would have to do is create a new alias with this command:</p>
<blockquote><p>New-Alias Do-Something C:\MyScripts\Miscellaneous\Do-Something.ps1</p>
</blockquote>
<p>That allows you to invoke your script any time you want to by simply using the Do-Something alias, as long as it is created and visible in the current scope.</p>
<p>Kirk out.</p>
<p>
<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dd907d1d-a3b3-45bb-a689-73d27fb4bc5e" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/alias" rel="tag">alias</a>,<a href="http://technorati.com/tags/script+file" rel="tag">script file</a>,<a href="http://technorati.com/tags/ps1" rel="tag">ps1</a></div>
</p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;title=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;;title=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;title=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;title=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;ti=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;title=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;title=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;title=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/&amp;t=PowerShell Quick Tip: Create aliases to facilitate invocation of PowerShell script (ps1) files" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0" /></a></td>
</tr>
</tbody>
</table>
<p> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=172&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/RKzBMjd_jfQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/02/04/powershell-quick-tip-create-aliases-to-facilitate-invocation-of-powershell-script-ps1-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>VMware Infrastructure PowerPack 2.1 released</title>
		<link>http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released/</link>
		<comments>http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 04:52:37 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[ESX]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[PowerPack]]></category>
		<category><![CDATA[VI Toolkit]]></category>
		<category><![CDATA[Virtual Center]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released/</guid>
		<description><![CDATA[Hot on the heels of the new release of the VMware VI Toolkit, I just finished uploading version 2.1 of the VMware Infrastructure Management PowerPack for PowerGUI.&#160; This PowerPack facilitates management and automation of VMware Infrastructure servers using the VMware VI Toolkit with PowerGUI’s extendable administrative console.
Version 2.1 of the VMware Infrastructure Management PowerPack includes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=171&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hot on the heels of the <a title="VI Toolkit 1.5 released" href="http://blogs.vmware.com/vipowershell/2009/01/vi-toolkit-15-released.html" target="_blank">new release</a> of the <a title="VMware Infrastructure Toolkit (for Windows)" href="http://vmware.com/go/powershell" target="_blank">VMware VI Toolkit</a>, I just finished uploading version 2.1 of the <a title="VMware PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a> for <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>.&#160; This PowerPack facilitates management and automation of VMware Infrastructure servers using the <a title="VMware Infrastructure Toolkit (for Windows)" href="http://vmware.com/go/powershell" target="_blank">VMware VI Toolkit</a> with <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>’s extendable administrative console.</p>
<p>Version 2.1 of the <a title="VMware PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a> includes the following highlights:</p>
<ul>
<li>Significant performance improvements when loading datacenters and clusters. </li>
<li>New top-level container nodes to facilitate viewing objects without having to browse into the Managed Hosts node. </li>
<li>Links allowing you to browse into log files from hosts. </li>
<li>Support for the <a title="VMware Infrastructure Toolkit (for Windows)" href="http://vmware.com/go/powershell" target="_blank">VMware VI Toolkit</a> 1.5 release. </li>
<li>VMotion support for virtual machines. </li>
</ul>
<p>In addition to these changes, several links have been added and quite a few defects have been fixed.</p>
<p>You can learn more about this PowerPack, including version history and other details <a title="VMware Infrastructure Management PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">here</a>.&#160; You can download it from that location as well.</p>
<p>As always, feedback on <a title="VMware Infrastructure Management PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">this PowerPack</a> and all others is welcome and appreciated.&#160; If you want to see something in the PowerPack, just ask!&#160; You can either contact me directly (see my <a title="About Kirk the Poshoholic" href="http://poshoholic.com/about/" target="_blank">about page</a>), or you can post your request using the <a title="PowerGUI Forums" href="http://www.powergui.org/forumindex.jspa?categoryID=55" target="_blank">PowerGUI forums</a>.&#160; We&#8217;re listening!</p>
<p>Kirk out.</p>
</p>
<p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e3ad755f-daf2-4053-b06b-0ba31dd8f9f2" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/VMware" rel="tag">VMware</a>,<a href="http://technorati.com/tags/PowerPack" rel="tag">PowerPack</a>,<a href="http://technorati.com/tags/Virtual+Center" rel="tag">Virtual Center</a>,<a href="http://technorati.com/tags/ESX" rel="tag">ESX</a>,<a href="http://technorati.com/tags/virtualization" rel="tag">virtualization</a>,<a href="http://technorati.com/tags/VI+Toolkit" rel="tag">VI Toolkit</a></div>
</p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;title=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;;title=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;title=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;title=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;ti=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;title=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;title=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;title=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released&amp;t=VMware Infrastructure PowerPack 2.1 released" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0" /></a></td>
</tr>
</tbody>
</table>
<p> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/171/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=171&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/14o7buZ3ILk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/02/01/vmware-infrastructure-powerpack-2-1-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script</title>
		<link>http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/</link>
		<comments>http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 00:45:05 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Quick Tip]]></category>
		<category><![CDATA[MyInvocation]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[__FILE__]]></category>
		<category><![CDATA[__LINE__]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/</guid>
		<description><![CDATA[(aka How to add C-style __LINE__ and __FILE__ macros to PowerShell)
When troubleshooting PowerShell scripts, it can be useful to log, store or output the current line number and and file name position so that you know where your script was when something happened.&#160; This information is given to you automatically when there is an error, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=168&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>(aka How to add C-style __LINE__ and __FILE__ macros to PowerShell)</p>
<p>When troubleshooting PowerShell scripts, it can be useful to log, store or output the current line number and and file name position so that you know where your script was when something happened.&#160; This information is given to you automatically when there is an error, however if you’re not facing a PowerShell error but you have a problem with the logic in your script, you need to manually retrieve it from PowerShell.</p>
<p>The MyInvocation variable was designed for this purpose, providing you with details about the invocation of the current script or function as well as details about the current command that you are executing.&#160; The trouble is that when you use $MyInvocation directly in a script file, the details it provides are about the invocation of the script, meaning the command used to invoke the script, and not about the current line within the script.&#160; Fortunately, though, as with many things PowerShell there is a way.&#160; To be able to use $MyInvocation to retrieve details about the current line in a script, you need to wrap it in a function and call that function.&#160; When you do this, $MyInvocation will give you details about the command used to call the function that contains it, and if that command is inside a script file the details will include the script file name as well as the line number of the command.</p>
<p>Armed with that knowledge, you can create a few useful functions in your profile, and they will allow you to retrieve the current file name and line number from within any script you use.&#160; Here are my interpretations of those functions:</p>
<p><span style="color:#0000ff;">#region</span><span style="color:#000000;"> Script Diagnostic Functions </span>    </p>
<p><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Get-CurrentLineNumber</span><span style="color:#000000;"> {</span>     <br /><span style="color:#800080;">&#160;&#160;&#160; $MyInvocation</span><span style="color:#000000;">.ScriptLineNumber</span>     <br /><span style="color:#000000;">}</span>     </p>
<p><span style="font-weight:bold;color:#5f9ea0;">New-Alias</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-style:italic;">-Name</span><span style="color:#000000;"> </span><span style="color:#800000;">__LINE__</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-style:italic;">-Value</span><span style="color:#000000;"> </span><span style="color:#800000;">Get-CurrentLineNumber</span><span style="color:#000000;"> –</span><span style="color:#5f9ea0;font-style:italic;">Description</span><span style="color:#000000;"> </span><span style="color:#800000;">&#8216;</span><span style="color:#800000;">Returns the current line number in a PowerShell script file.</span><span style="color:#800000;">&#8216;</span>     </p>
<p><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Get-CurrentFileName</span><span style="color:#000000;"> {</span>     <br /><span style="color:#800080;">&#160;&#160;&#160; $MyInvocation</span><span style="color:#000000;">.ScriptName</span>     <br /><span style="color:#000000;">}</span>     </p>
<p><span style="font-weight:bold;color:#5f9ea0;">New-Alias</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-style:italic;">-Name</span><span style="color:#000000;"> </span><span style="color:#800000;">__FILE__</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-style:italic;">-Value</span><span style="color:#000000;"> </span><span style="color:#800000;">Get-CurrentFileName</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-style:italic;">-Description</span><span style="color:#000000;"> </span><span style="color:#800000;">&#8216;</span><span style="color:#800000;">Returns the name of the current PowerShell script file.</span><span style="color:#800000;">&#8216;</span>     </p>
<p><span style="color:#0000ff;">#endregion</span></p>
<p>A few good uses for these functions might be:</p>
<ol>
<li>In complicated scripts where you want to verify the order of execution of certain lines of script. </li>
<li>When you are returning a value in multiple locations and you would like to simply know which location you returned from while troubleshooting without stepping through any lines in your script. </li>
</ol>
<p>I hope this is useful for you.&#160; I just started using these functions and they are already coming in quite handy for me.</p>
<p>Enjoy!</p>
<p>Kirk out.</p>
</p>
<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:044f6449-e0f5-4a06-9bd6-223f77251f80" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/MyInvocation" rel="tag">MyInvocation</a></div>
</p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;title=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;;title=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;title=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;title=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;ti=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;title=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;title=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;title=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0" /></a></td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/&amp;t=PowerShell Quick Tip: How to retrieve the current line number and file name in your PowerShell script" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0" /></a></td>
</tr>
</tbody>
</table>
<p> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/168/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=168&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/w8yIJXWEAOc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2009/01/19/powershell-quick-tip-how-to-retrieve-the-current-line-number-and-file-name-in-your-powershell-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>VMware Infrastructure PowerPack 2.0 is now available</title>
		<link>http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available/</link>
		<comments>http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 22:41:40 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[ESX]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[PowerPack]]></category>
		<category><![CDATA[VI Toolkit]]></category>
		<category><![CDATA[Virtual Center]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available/</guid>
		<description><![CDATA[
Were you&#160; curious what was hiding inside that gold box in the&#160; PowerGUI train?&#160; Keeping with the spirit of giving, I just finished publishing version 2.0 of the VMware Infrastructure Management PowerPack.&#160; A lot of effort went into this PowerPack, which ended up including a complete restructuring of the elements in the tree, as well [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=163&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strike></strike>
<p>Were you&#160; curious what was hiding inside that gold box in the<a title="PowerGUI Christmas Wallpaper" href="http://www.powergui.org/servlet/KbServlet/download/2193-102-3153/XMas-PowerGUI-Wallpaper-1920x1200.jpg" target="_blank"><img style="display:inline;border-width:0;margin:7px 0 2px 7px;" title="image" border="0" alt="image" align="right" src="http://kirkmunro.files.wordpress.com/2009/04/image.png?w=300&#038;h=188" width="300" height="188" /></a>&#160; <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> train?&#160; Keeping with the spirit of giving, I just finished publishing version 2.0 of the <a title="VMware PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a>.&#160; A lot of effort went into this PowerPack, which ended up including a complete restructuring of the elements in the tree, as well as the addition of a lot of new functionality that was not available in previous versions, all for free just like the <a title="PowerPack Library" href="http://www.powergui.org/kbcategory.jspa?categoryID=21" target="_blank">many other PowerPacks</a> that are available for <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>.</p>
<p>A few highlights in this version include:</p>
<ul>
<li>Easy management of multiple VMware Virtual Center, ESX, ESXi or Virtual Server hosts from within one console. </li>
<li>Single sign-on to multiple hosts that use the same credentials. </li>
<li>Support for browsing through any of the inventory hierarchical views that are available in Virtual Center. </li>
<li>Management of virtualization elements within one host or across many hosts through the same set of links and actions. </li>
<li>Reporting and management of sessions, datacenters, clusters, resource pools, hosts, folders, virtual machines, templates, snapshots, networks, datastores, files, tasks and log files. </li>
</ul>
<p>You can learn more about this PowerPack, including version history and other details <a title="VMware Infrastructure Management PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">here</a>.&#160; You can download it from that location as well.</p>
<p>Still not convinced you should give the <a title="VMware PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">VMware Infrastructure Management PowerPack</a> a look?&#160; Below you can click on a few screenshots to get a taste of what you&#8217;ll find if you do.</p>
<p><strong>Browsing the Virtual Center hierarchy while managing snapshot files</strong></p>
<p><a title="Browsing the Virtual Center hierarchy" href="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Browsing_the_hierarchy.jpg" target="_blank"><img src="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Browsing_the_hierarchy.jpg" width="400" height="242" /></a> </p>
<p><strong>Managing host sessions</strong></p>
<p><a title="Managing VMware Host Sessions" href="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Managing_sessions.jpg" target="_blank"><img src="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Managing_sessions.jpg" width="400" height="242" /></a> </p>
<p><strong>Managing virtual machines</strong></p>
<p><a title="Managing virtual machines" href="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Managing_virtual_machines.jpg" target="_blank"><img src="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Managing_virtual_machines.jpg" width="400" height="242" /></a></p>
<p><strong>Looking into log files</strong></p>
<p><a title="Looking into host log files" href="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Reaching_into_the_log_files.jpg" target="_blank"><img src="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Reaching_into_the_log_files.jpg" width="400" height="242" /></a> </p>
<p>If you manage VMware hosts or if you are interested in writing scripts against VMware hosts using PowerShell, I strongly encourage you to give this PowerPack a look.</p>
<p>As always, feedback on <a title="VMware Infrastructure Management PowerPack" href="http://www.powergui.org/entry.jspa?externalID=1802&amp;categoryID=290" target="_blank">this PowerPack</a> and all others is welcome and appreciated.&#160; If you want to see something in the PowerPack, just ask!&#160; You can either contact me directly (see my <a title="About Kirk the Poshoholic" href="http://poshoholic.com/about/" target="_blank">about page</a>), or you can post your request using the <a title="PowerGUI Forums" href="http://www.powergui.org/forumindex.jspa?categoryID=55" target="_blank">PowerGUI forums</a>.&#160; We&#8217;re listening!</p>
<p>Happy Holidays everyone!</p>
<p>Kirk out.</p>
</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e3ad755f-daf2-4053-b06b-0ba31dd8f9f2" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/VMware" rel="tag">VMware</a>,<a href="http://technorati.com/tags/PowerPack" rel="tag">PowerPack</a>,<a href="http://technorati.com/tags/Virtual+Center" rel="tag">Virtual Center</a>,<a href="http://technorati.com/tags/ESX" rel="tag">ESX</a>,<a href="http://technorati.com/tags/virtualization" rel="tag">virtualization</a>,<a href="http://technorati.com/tags/VI+Toolkit" rel="tag">VI Toolkit</a></div>
</p>
<p> <span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;title=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" /></a> </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;;title=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /></a> </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;title=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /></a> </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;title=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /></a> </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;ti=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" /></a> </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;title=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" /></a> </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;title=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" /></a> </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;title=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" /></a> </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available&amp;t=VMware Infrastructure PowerPack 2.0 is Now Available" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /></a></td>
</tr>
</tbody>
</table>
<p> </span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/163/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=163&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/KhAozABAgmg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2008/12/19/vmware-infrastructure-powerpack-20-is-now-available/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2009/04/image.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Browsing_the_hierarchy.jpg" medium="image" />

		<media:content url="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Managing_sessions.jpg" medium="image" />

		<media:content url="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Managing_virtual_machines.jpg" medium="image" />

		<media:content url="http://www.powergui.org/shares/powergui/sbin/images/VMware_PowerPack/Reaching_into_the_log_files.jpg" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>PowerShell Challenge: Converting objects to types defined at runtime</title>
		<link>http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/</link>
		<comments>http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 01:59:38 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Challenge]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2008/11/24/powershell-challenge-converting-types-at-runtime/</guid>
		<description><![CDATA[I was recently working on a function where I had to convert objects to a type that was passed into the function when I came across something that may surprise some people.&#160; Assuming you have a type stored in $type, what is the difference between the following two commands (other than style):

$result = Invoke-Expression &#8220;[$type]`$value&#8221;
Invoke-Expression [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=160&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was recently working on a function where I had to convert objects to a type that was passed into the function when I came across something that may surprise some people.&nbsp; Assuming you have a type stored in $type, what is the difference between the following two commands (other than style):</p>
<ol>
<li>$result = Invoke-Expression &#8220;[$type]`$value&#8221;
<li>Invoke-Expression &#8220;`$result = [$type]`$value&#8221;</li>
</ol>
<p>I don&#8217;t have any prizes for this, but I thought it was worth asking just for fun.&nbsp; I&#8217;ll post the solution after people have had some time to take a crack at it.</p>
<p><strong>Solution</strong></p>
<p>It&#8217;s been long enough to let people chew on this, so I can share the solution.&nbsp; Only two people came back to me indicating that they had figured it out: <a title="Arnoud Jansveld" href="http://www.jansveld.net/powershell" target="_blank">Arnoud Jansveld</a> and <a title="Under the Stairs" href="http://tfl09.blogspot.com/" target="_blank">Thomas Lee</a>.</p>
<p>The key difference between these is in how data is assigned to the $result variable when using an array.&nbsp; In the first case, Invoke-Expression returns the converted $value (after it has been case to $type), but that return $value is then implicitly sent to Out-Default, which returns generic objects (boxing), so in the end if you started with an array you have a collection of objects (System.Object[]).&nbsp; In the second case, the assignment is done inside of Invoke-Expression, before any boxing would occur.&nbsp; Once the assignment is done, nothing is returned from Invoke-Expression, and you end up with an array of the type you were expecting.</p>
<p>This was just a silly little exercise, but it illustrates an important concept in PowerShell by showing how objects coming out the end of a pipeline are boxed in generic System.Objects.&nbsp; That knowledge comes in handy from time to time when you are scripting, so it is worth remembering.</p>
<p>Enjoy!</p>
<p>Kirk out.</p>
</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d232604b-3390-4fb0-b4d2-7a9f78773c34" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerShell%20Challenge" rel="tag">PowerShell Challenge</a></div>
</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;title=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;;title=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;title=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;title=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;ti=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;title=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;title=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;title=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/&amp;t=PowerShell Challenge: Converting types at runtime" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=160&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/Soa7d0nZh7Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2008/11/24/powershell-challenge-converting-types-at-runtime/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Introduction to the Hyper-V PowerPack Screencast</title>
		<link>http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/</link>
		<comments>http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 06:00:34 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/</guid>
		<description><![CDATA[I recently published a new screencast on the PowerGUI Documentation page called &#8220;Introduction to the Hyper-V PowerPack&#8220;.&#160; If you want to learn a little bit about what this PowerPack can offer you and how you can get started using it, take a few minutes and watch the screencast today!
In case you haven&#8217;t had a chance [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=159&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I recently published a new <a title="Introduction to the Hyper-V PowerPack" href="http://www.powergui.org/shares/powergui/sbin/docs/Introduction_to_the_HyperV_PowerPack/Introduction_to_the_HyperV_PowerPack.html" target="_blank">screencast</a> on the <a title="PowerGUI Documentation" href="http://www.powergui.org/documentation.jspa" target="_blank">PowerGUI Documentation</a> page called &#8220;<a title="Introduction to the Hyper-V PowerPack" href="http://www.powergui.org/shares/powergui/sbin/docs/Introduction_to_the_HyperV_PowerPack/Introduction_to_the_HyperV_PowerPack.html" target="_blank">Introduction to the Hyper-V PowerPack</a>&#8220;.&nbsp; If you want to learn a little bit about what this PowerPack can offer you and how you can get started using it, take a few minutes and watch the screencast today!</p>
<p>In case you haven&#8217;t had a chance to see some of the functionality that this PowerPack provides you with, I&#8217;m including a few screenshots below to give you a quick preview.&nbsp; Or, if you want to see the list of custom functions that drive the functionality in this PowerPack, read my blog post titled, &#8220;<a title="Use PowerPacks to Learn PowerShell" href="http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/" target="_blank">Use PowerPacks to Learn PowerShell</a>&#8220;.</p>
<h5>Managing VMs using the Hyper-V PowerPack:</h5>
<p><a title="Managing VMs using the Hyper-V PowerPack" href="http://www.powergui.org/servlet/KbServlet/downloadImage/2142-102-164/Hyper-V_PowerPack_-_Managing_VMs.jpg" target="_blank"><img height="307" src="http://www.powergui.org/servlet/KbServlet/downloadImage/2142-102-164/Hyper-V_PowerPack_-_Managing_VMs.jpg" width="420"></a> </p>
<h5>Managing Snapshots using the Hyper-V PowerPack:</h5>
<p><a title="Managing Snapshots using the Hyper-V PowerPack" href="http://www.powergui.org/servlet/KbServlet/downloadImage/2142-102-165/Hyper-V_PowerPack_-_Managing_Snapshots.jpg" target="_blank"><img height="306" src="http://www.powergui.org/servlet/KbServlet/downloadImage/2142-102-165/Hyper-V_PowerPack_-_Managing_Snapshots.jpg" width="420"></a> </p>
<p>Kirk out.</p>
<p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4b8b9ee9-8054-4c92-aa2b-f7d024c5b6ef" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Hyper-V" rel="tag">Hyper-V</a>,<a href="http://technorati.com/tags/Windows%20Server%202008" rel="tag">Windows Server 2008</a>,<a href="http://technorati.com/tags/virtualization" rel="tag">virtualization</a>,<a href="http://technorati.com/tags/WMI" rel="tag">WMI</a></div>
</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;title=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;;title=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;title=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;title=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;ti=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;title=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;title=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;title=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/&amp;t=Introduction to the Hyper-V PowerPack Screencast" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/159/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=159&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/ZKvKx312R_o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2008/11/17/introduction-to-the-hyper-v-powerpack-screencast/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://www.powergui.org/servlet/KbServlet/downloadImage/2142-102-164/Hyper-V_PowerPack_-_Managing_VMs.jpg" medium="image" />

		<media:content url="http://www.powergui.org/servlet/KbServlet/downloadImage/2142-102-165/Hyper-V_PowerPack_-_Managing_Snapshots.jpg" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Use PowerPacks to Learn PowerShell</title>
		<link>http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/</link>
		<comments>http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 01:43:03 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2008/11/16/use-powerpacks-to-learn-powershell/</guid>
		<description><![CDATA[The Hyper-V PowerPack for PowerGUI that I published last month is one of my favorite PowerPacks so far.&#160; It&#8217;s a great example of how you can take a task that is pretty complicated for someone who doesn&#8217;t program for a living (like using PowerShell to manage Hyper-V via WMI), simplify it with rich PowerShell functions [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=158&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> for <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> that I published last month is one of my favorite PowerPacks so far.&nbsp; It&#8217;s a great example of how you can take a task that is pretty complicated for someone who doesn&#8217;t program for a living (like using PowerShell to manage Hyper-V via WMI), simplify it with rich PowerShell functions that look and feel like cmdlets, and then build a user interface on top those functions to perform management and automation tasks.&nbsp; Since all of the PowerShell script behind the PowerPack is freely available through the <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> Admin Console, using a PowerPack like the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> is a great way to learn PowerShell because it allows you to get familiar with how specific administrative tasks translate into PowerShell scripts that you can then use for automation, provisioning, scheduled tasks, etc.</p>
<p>The scripts powering the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> are particularly interesting because there are no cmdlets available yet to manage Hyper-V unless you use <a title="Microsoft System Center Virtual Machine Manager 2008" href="http://www.microsoft.com/systemcenter/virtualmachinemanager/" target="_blank">Microsoft System Center Virtual Machine Manager 2008</a>.&nbsp; The prescribed way to manage Hyper-V via script with the release of Windows Server 2008 is WMI.&nbsp; Since working with WMI directly is not much fun after you have become spoiled with the ease-of-use you get with PowerShell cmdlets, not to mention quite difficult, I have included a lot of useful functions (over 30 of them so far) that wrap the WMI management code inside of a cmdlet-like experience complete with support for pipelining so that you can write scripts to work with your Hyper-V servers much more easily.&nbsp; Here&#8217;s a complete list of the functions that are included in the current revision of the Hyper-V PowerPack:</p>
<h5>Job Management</h5>
<p>Get-HyperVJob<br />Wait-HyperVJob</p>
<h5>Server Configuration</h5>
<p>Get-HyperVServerSettings<br />Set-HyperVServerSettings</p>
<h5>Service Management</h5>
<p>Get-HyperVService</p>
<h5>Physical Network Adapter Management</h5>
<p>Get-HyperVPhysicalNIC<br />Set-HyperVPhysicalNIC</p>
<h5>Virtual Network Management</h5>
<p>Get-HyperVVirtualNetwork<br />New-HyperVVirtualNetwork<br />Remove-HyperVVirtualNetwork<br />Rename-HyperVVirtualNetwork<br />Set-HyperVVirtualNetwork</p>
<h5>Virtual Machine Management</h5>
<p>Checkpoint-HyperVVirtualMachine<br />Export-HyperVVirtualMachine<br />Get-HyperVVirtualMachine<br />Import-HyperVVirtualMachine<br />New-HyperVVirtualMachine<br />Remove-HyperVVirtualMachine<br />Rename-HyperVVirtualMachine<br />Restore-HyperVVirtualMachine<br />Set-HyperVVirtualMachine</p>
<h5>Virtual Network Adapter Management</h5>
<p>Add-HyperVVirtualNIC<br />Get-HyperVVirtualNIC<br />Remove-HyperVVirtualNIC<br />Set-HyperVVirtualNIC</p>
<h5>Virtual Ide Drive Management</h5>
<p>Add-HyperVVirtualIdeDrive</p>
<h5>Virtual Scsi Drive Management</h5>
<p>Add-HyperVVirtualScsiDrive</p>
<h5>Snapshot Management</h5>
<p>Get-HyperVSnapshot<br />Set-HyperVSnapshot<br />Remove-HyperVSnapshot<br />Rename-HyperVSnapshot<br />Update-HyperVSnapshot</p>
<h5>Virtual Hard Disk Management</h5>
<p>Get-HyperVVirtualHardDisk<br />New-HyperVVirtualHardDisk</p>
<p>These functions do not provide comprehensive coverage of all Hyper-V features and there are many more that I plan to add in a future update, but it&#8217;s well on it&#8217;s way to becoming a comprehensive set of functions.&nbsp; If you are looking for specific functionality that doesn&#8217;t appear to be available through these functions, I encourage you to take a look at the methods on the rich objects that are output by these functions.&nbsp; There is a whole lot more functionality available than you might think!&nbsp; I just haven&#8217;t had time to expose all of the method-based functionality as cmdlet-like functions yet.</p>
<p>To use these functions in your own scripts you simply have to copy them out of the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a>.&nbsp; Be sure to keep an eye on dependencies and make sure you get all the functions you need.&nbsp; Most of the PowerPacks I&#8217;ve been working on lately come with useful functions like this, for the explicit reason that I want people to be able to use them inside and outside of <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>.&nbsp; I&#8217;ll blog about them as time permits, but until I make time for that I wanted to at least make you aware that they are there as a resource and as a learning tool.</p>
<p>If you want to write PowerShell scripts to manage your Hyper-V servers, doing yourself a favor to take a look at the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> and the functions that it contains.&nbsp; They might go a long way to helping you get your work done faster and more easily, either by using the functions themselves in your scripts or by looking at the PowerShell code behind the functions and learning how to get WMI to do what you want to do.</p>
<p>Kirk out.</p>
<p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2ed27f47-b915-4caf-a2e8-4afa9f472ca1" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Hyper-V" rel="tag">Hyper-V</a>,<a href="http://technorati.com/tags/Windows%20Server%202008" rel="tag">Windows Server 2008</a>,<a href="http://technorati.com/tags/virtualization" rel="tag">virtualization</a>,<a href="http://technorati.com/tags/WMI" rel="tag">WMI</a></div>
</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;title=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;;title=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;title=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;title=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;ti=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;title=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;title=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;title=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/&amp;t=Use PowerPacks to Learn PowerShell" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/158/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=158&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/w5H33Z_r9y4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2008/11/16/use-powerpacks-to-learn-powershell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Hyper-V PowerPack Updated</title>
		<link>http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/</link>
		<comments>http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 19:10:42 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2008/11/16/hyper-v-powerpack-updated/</guid>
		<description><![CDATA[Since the Hyper-V PowerPack for PowerGUI was published several weeks ago, I have found and fixed several defects, particularly in the area of adding and removing managed Hyper-V servers.&#160; I have also enhanced the search functionality so that it is easier to use when you work with one domain in particular.&#160; To see the complete [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=157&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Since the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> for <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> was published several weeks ago, I have found and fixed several defects, particularly in the area of adding and removing managed Hyper-V servers.&nbsp; I have also enhanced the search functionality so that it is easier to use when you work with one domain in particular.&nbsp; To see the complete list of changes, see the revision history section on the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> page.</p>
<p>If you downloaded the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> before Friday, November 14, 2008, I recommend that you visit the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> site and upgrade your PowerPack to the most recent version.&nbsp; Upgrading the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> can be done in a few easy steps, as follows:</p>
<ol>
<li>Download the new version of the PowerPack.</li>
<li>Open the PowerGUI Admin Console if you haven&#8217;t already.</li>
<li>Right-click the Hyper-V folder at the root of the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry.jspa?externalID=2142&amp;categoryID=290" target="_blank">Hyper-V PowerPack</a> in <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> and click on Delete.</li>
<li>Right-click the root node in the <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> tree, click on Import, and select the updated HyperV.powerpack file that you downloaded.</li>
</ol>
<p>Once you have done these steps, you will be using the most recent version of this PowerPack.&nbsp; If you have any feedback or questions you would like to raise for this PowerPack or any others, please feel free to contact me directly (see <a title="Poshoholic About Page" href="http://poshoholic.com/about/" target="_blank">my about page</a> for details) or leave me a note on the <a title="PowerGUI Forums" href="http://www.powergui.org/forumindex.jspa?categoryID=55" target="_blank">PowerGUI Forums</a>.</p>
<p>Enjoy!</p>
<p>Kirk out.</p>
<p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:0d7d6a49-2015-4b30-ad21-19aa9b944490" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Hyper-V" rel="tag">Hyper-V</a>,<a href="http://technorati.com/tags/Windows%20Server%202008" rel="tag">Windows Server 2008</a>,<a href="http://technorati.com/tags/virtualization" rel="tag">virtualization</a>,<a href="http://technorati.com/tags/WMI" rel="tag">WMI</a></div>
</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;title=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;;title=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;title=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;title=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;ti=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;title=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;title=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;title=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/&amp;t=Hyper-V PowerPack Updated" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/157/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=157&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/NBAIcxo9b4M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2008/11/16/hyper-v-powerpack-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>PowerGUI: Now with 100% more Hyper-V!</title>
		<link>http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/</link>
		<comments>http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 05:33:44 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2008/10/22/powergui-now-with-100-more-hyper-v/</guid>
		<description><![CDATA[About three months ago I decided to go on a deep technology dive, exploring a facet of some technology with PowerShell and seeing what made it tick.&#160; Typically these sorts of things take anywhere from a few days to a few weeks to work out the details and the end result is some useful scripts [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=154&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>About three months ago I decided to go on a deep technology dive, exploring a facet of some technology with PowerShell and seeing what made it tick.&nbsp; Typically these sorts of things take anywhere from a few days to a few weeks to work out the details and the end result is some useful scripts that I then blog about and try to leverage with a PowerPack or two.&nbsp; Well this time I ended up going a little deeper than I have in the past, and I decided to go silent on my blog while I worked out the PowerShell scripts behind this huge project.&nbsp; Today I&#8217;m happy to end that silence by sharing with you the largest PowerPack that has been published to date!</p>
<p><a href="http://kirkmunro.files.wordpress.com/2008/10/hyper-v-drink.jpg"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="233" alt="Hyper-V Drink" src="http://kirkmunro.files.wordpress.com/2008/10/hyper-v-drink-thumb.jpg?w=183&#038;h=233" width="183" align="right" border="0"></a>As of today, PowerGUI users can download a <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry!default.jspa?categoryID=290&amp;externalID=2142" target="_blank">free Hyper-V PowerPack</a> for <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>!&nbsp; This PowerPack has been a huge undertaking, to put it mildly, and I&#8217;m absolutely thrilled with the end result (and so happy that I&#8217;ve finally finished the first version&#8230;whew)!&nbsp; Here&#8217;s a list of some of the key features that this PowerPack provides:</p>
<ol>
<li>Bulk management of multiple VMs, Virtual Networks, Virtual Hard Drives, Snapshots, etc. within one Hyper-V servers and across multiple Hyper-V servers.</li>
<li>Support for remote management of Hyper-V servers using alternate credentials.</li>
<li>Integrated management of standard Windows features like Processes, Services, Event Logs, etc.</li>
<li>Automatic credential caching (in memory, not to disk) allowing you to enter a password for a Hyper-V server you are managing only once per PowerGUI session.</li>
<li>Discovery of Hyper-V servers through Active Directory.</li>
<li>Over 30 rich user-defined functions that wrap the Hyper-V WMI interfaces and provide a cmdlet-like experience when scripting with Hyper-V while outputting rich, custom objects complete with properties and methods to script to your heart&#8217;s content.&nbsp; Many of these functions support CSV input through Import-Csv, so there are a lot of opportunities for provisioning already available.</li>
<li>101 links and actions allowing you to manage just about everything you would want to manage in Hyper-V, including configuration of security via AzMan Scopes, Snapshot refresh, and many, many more.</li>
</ol>
<p>In terms of Hyper-V functionality, the PowerPack is pretty comprehensive at this point.&nbsp; There are some features that I have support for in functions that I just didn&#8217;t have time to put into the PowerPack at the end of this cycle.&nbsp; There are also quite a few features in the PowerPack that aren&#8217;t available in the Hyper-V Manager.&nbsp; But that just means there are opportunities for new features to be added in later versions of this PowerPack.&nbsp; Let me know what features are the most important to you so that I can help you meet your Hyper-V management/scripting needs.</p>
<p>To give you an idea of what it took to make this PowerPack, the main script that contains the function library I&#8217;m using in this PowerPack is over 9500 lines long (if you&#8217;re new to PowerShell, that&#8217;s a heck of a lot of code in a language that lets you do so much with very, very short scripts)!&nbsp; This huge script, and the scripts powering the links and actions, plus the rest of the PowerShell script behind the <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> PowerPacks are all visible to the end user.&nbsp; If you&#8217;re trying to figure out how to do something with Hyper-V via WMI and you can&#8217;t find the answer, take a look at the functions I have and see if they are already doing what you want to do.&nbsp; Then you can use the functions or try to copy out the code that you need and go from there!</p>
<p>Just a quick note to get you started, once you download and import the PowerPack into <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>, expand the Hyper-V node and then click on Managed Hyper-V Servers.&nbsp; That will expose the Add Connection functionality you need to use to add your first connection to a Hyper-V server.&nbsp; Once you&#8217;ve done that, you&#8217;ll be able to use the rest of the functionality against that server.</p>
<p>If you have any feedback for this PowerPack (or any others), feel free to leave a note on my blog or on the <a title="PowerGUI forums" href="http://www.powergui.org/forumindex.jspa?categoryID=55" target="_blank">PowerGUI discussion forums</a>.&nbsp; We&#8217;ll be sure to try and help you meet your needs any way that we can!</p>
<p>So what are you waiting for?&nbsp; Go to the <a title="Hyper-V PowerPack" href="http://www.powergui.org/entry!default.jspa?categoryID=290&amp;externalID=2142" target="_blank">Hyper-V PowerPack</a> site and download the PowerPack today!</p>
<p>Kirk out.</p>
<p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:7883ac57-b446-4457-8fa3-d2d036914f6d" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a>,<a href="http://technorati.com/tags/Hyper-V" rel="tag">Hyper-V</a>,<a href="http://technorati.com/tags/Windows%20Server%202008" rel="tag">Windows Server 2008</a>,<a href="http://technorati.com/tags/virtualization" rel="tag">virtualization</a>,<a href="http://technorati.com/tags/WMI" rel="tag">WMI</a></div>
</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;title=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;;title=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;title=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;title=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;ti=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;title=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;title=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;title=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/&amp;t=PowerGUI: Now with 100% more Hyper-V" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=154&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/kaDQeN79nmA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2008/10/22/powergui-now-with-100-more-hyper-v/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2008/10/hyper-v-drink-thumb.jpg" medium="image">
			<media:title type="html">Hyper-V Drink</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Essential PowerShell: Define default properties for custom objects</title>
		<link>http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/</link>
		<comments>http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 07:25:07 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[Essential PowerShell]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>
		<category><![CDATA[Select-Member]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/</guid>
		<description><![CDATA[After posting my blog entry about naming your custom object types on Thursday, Hal Rottenberg left me a comment saying how it&#8217;s a shame that you have to manually create ps1xml files to store your type data and format data extensions.&#160; Hal&#8217;s right.&#160; Having to create ps1xml files to accompany each script you make that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=150&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After posting my <a title="Name your custom object types" href="http://poshoholic.com/2008/07/03/essential-powershell-name-your-custom-object-types" target="_blank">blog entry about naming your custom object types</a> on Thursday, <a title="Hal Rottenberg" href="http://halr9000.com" target="_blank">Hal Rottenberg</a> left me a comment saying how it&#8217;s a shame that you have to manually create ps1xml files to store your type data and format data extensions.&nbsp; Hal&#8217;s right.&nbsp; Having to create ps1xml files to accompany each script you make that generates custom objects is too much work for the script author, and the script consumer has more files to download each time.&nbsp; But then I thought twice about what Hal said, and asked myself: Is creating the ps1xml files to get the output you want from custom objects really necessary?</p>
<p>Fortunately the answer to this is &#8220;No&#8221;.&nbsp; But why not?&nbsp; Before I answer that, I should give a short explanation about how PowerShell determines what properties it will display when an object is output and in what format that object will be displayed.</p>
<p><strong>How PowerShell determines the default format for an object</strong></p>
<p>Let&#8217;s use the WMI service object for the Windows Update service as an example.&nbsp; You can get this object in PowerShell using this command:</p>
<blockquote><p>$object = gwmi Win32_Service -Filter &#8216;name=&#8221;wuauserv&#8221;&#8216;</p>
</blockquote>
<p>This command calls Get-WmiObject (using the gwmi alias) and requests the Win32_Service object that has the name &#8220;wuauserv&#8221;.&nbsp; The result object is stored in the $object variable.</p>
<p>Now that the object is stored, if you want to view it you simply need to enter &#8220;$object&#8221; (minus the quotes) in your PowerShell console and you&#8217;ll see the default representation of that object.&nbsp; It looks like this:</p>
<p><a href="http://kirkmunro.files.wordpress.com/2008/07/image.png" target="_blank"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="184" alt="image" src="http://kirkmunro.files.wordpress.com/2008/07/image-thumb.png?w=404&#038;h=184" width="404" border="0"></a> </p>
<p>Here you can see the ExitCode, Name, ProcessId, StartMode, State and Status properties for the Win32_Service object.&nbsp; There are many more properties than these six though.&nbsp; You can type &#8220;$object | Format-List *&#8221; in PowerShell for yourself to see them all&#8230;there is quite a long list.&nbsp; So how did PowerShell decide that these six properties were the ones to display by default?&nbsp; In this case, the object itself contained the list of properties that would be displayed by default.&nbsp; In PowerShell, any object may have the set of properties that will be output by default when that object is displayed stored in a member on the object itself.&nbsp; It&#8217;s not kept in the most obvious of locations, but you can find it when you need to.</p>
<p>For any object in PowerShell, you can access its PSStandardMembers.DefaultDisplayPropertySet property to see the properties that are default for that object, if they are defined.&nbsp; They won&#8217;t be defined for all objects, but in our example, they happen to be.&nbsp; I show the results of the command to see the default property set here:</p>
<p><a href="http://kirkmunro.files.wordpress.com/2008/07/image1.png" target="_blank"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="172" alt="image" src="http://kirkmunro.files.wordpress.com/2008/07/image-thumb1.png?w=404&#038;h=172" width="404" border="0"></a> </p>
<p>In this output window, the ReferencedPropertyNames property contains the list of properties that are displayed in PowerShell by default (ExitCode, Name, ProcessId, &#8230;).</p>
<p>What caused our object to display the properties in list format though?&nbsp; After the default properties are set on an object (assuming they are set), when you output an object to the console without any Format-verb cmdlets at the end of the pipeline, the PowerShell formatting engine looks in the format data it has loaded and finds the first format data specification whose object type matches the one of the types in the object hierarchy that can be found by accessing the PSObject.TypeNames parameter.&nbsp; It doesn&#8217;t matter if it is for a list format, a table format, a wide format, or a custom format &#8212; the first one found is used.&nbsp; The types in the object hierarchy are looked up starting with the lowest derived type (index 0 in that collection) and then moving on to the next lowest (index 1), and so on until the base type is reached.</p>
<p>For our Win32_Service object, there is no format data specification for any of the object types, in which case PowerShell applies a default formatting rule: if there are four properties or less in the list of properties to display (the default properties if they were assigned, all properties if they were not), display the object in table format; otherwise, display it in list format.&nbsp; For other types of objects there may be formatting data found, and when this happens the default properties are ignored and the default format is derived using the first matching format data specification.&nbsp; This simplifies this whole process, but it should give you an idea how it works.</p>
<p><strong>How to define the default properties for any object</strong></p>
<p>Now that you have a general idea how formatting works, do you see the shortcut to defining the default output for custom objects you create?&nbsp; Here&#8217;s a hint: it isn&#8217;t through the creation of a ps1xml file.</p>
<p>The easiest way to define the default output for a custom object is to add a PSStandardMembers member to the object and set the default properties in that member.&nbsp; For objects that don&#8217;t have their default properties defined in a type data file, this is very easy to do.&nbsp; Assume you have a script that generates and returns one or more custom objects with six properties: Name, Property1, Property2, Property3, Property4 and Property5.&nbsp; Here&#8217;s a script to create one such object:</p>
<blockquote><p><font color="#333333">$myObject = New-Object PSObject<br />$myObject | Add-Member NoteProperty Name &#8216;My Object&#8217;<br />$myObject | Add-Member NoteProperty Property1 1<br />$myObject | Add-Member NoteProperty Property2 2<br />$myObject | Add-Member NoteProperty Property3 3<br />$myObject | Add-Member NoteProperty Property4 4<br />$myObject | Add-Member NoteProperty Property5 5</font></p>
</blockquote>
<p>To view this object, enter $MyObject in the console.&nbsp; Here is the default output for that object:</p>
<p><a href="http://kirkmunro.files.wordpress.com/2008/07/image2.png" target="_blank"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="182" alt="image" src="http://kirkmunro.files.wordpress.com/2008/07/image-thumb2.png?w=404&#038;h=182" width="404" border="0"></a> </p>
<p>There are no default properties assigned for this object and there are no type data or format data for the object type, so PowerShell resorts to determining the output format based on the number of properties that the object has.&nbsp; This is fine for one object, like we have here, but if you have a script that returns a collection of these, having their default output in list format does not give users of your script a very good user experience because it is very hard to find information in a long list of objects output in list format in PowerShell.&nbsp; To show the objects in table format users can simply pipe them to the Format-Table cmdlet where they can specify the properties to show, but they shouldn&#8217;t have to do that.&nbsp; Instead, you can update your script so that it specifies the default properties when these objects are created.&nbsp; Here are the additional commands required to specify the default properties for our sample object:</p>
<blockquote><p><font color="#333333">$defaultProperties = @(&#8216;Name&#8217;,'Property2&#8242;,&#8217;Property4&#8242;)</font></p>
<p><font color="#333333">$defaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet(&#8216;DefaultDisplayPropertySet&#8217;,[string[]]$defaultProperties)</font></p>
<p><font color="#333333">$PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]@($defaultDisplayPropertySet)</font></p>
<p><font color="#333333">$myObject | Add-Member MemberSet PSStandardMembers $PSStandardMembers</font></p>
</blockquote>
<p>The first command sets the default properties.&nbsp; Then in the next command we create a new property set containing those default properties.&nbsp; With that property set, we can create the collection of member info objects we need.&nbsp; And then once we have that collection we can add that as our member set to our object.</p>
<p>After you have done this your custom object will display the default properties you specified when you output it without any Format-verb cmdlets.&nbsp; Here&#8217;s our $myObject default output after running the commands shown above:</p>
<p><a href="http://kirkmunro.files.wordpress.com/2008/07/image3.png" target="_blank"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="156" alt="image" src="http://kirkmunro.files.wordpress.com/2008/07/image-thumb3.png?w=404&#038;h=156" width="404" border="0"></a> </p>
<p>That&#8217;s more like it!&nbsp; Now we have a custom object with a predefined default property set, ready for users to start using, and our custom object still contains all of the properties for the object so that users can get additional fields if they want them!</p>
<p><strong>Taking it further</strong></p>
<p>Armed with this knowledge, you should be able to specify the default properties on any custom objects you create without using ps1xml files.&nbsp; What if you wanted to take this further?&nbsp; What functionality would be useful to have for this in a generic script so that you could get even more use out of it?</p>
<p>Using the knowledge derived above I was able to put together a script called <a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member.ps1</a> that provides rich support for selecting the default properties for an object if none exist, or overriding the default properties for an object if they were defined in a type data file.&nbsp; <a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member</a> can be used in a pipeline against a collection, or it can be used by itself passing the objects to process into the inputObject property.</p>
<p>Note that when you download this script, if you haven&#8217;t already you will also need to download <a title="Get-PSResourceString.ps1" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Get-PSResourceString.ps1" target="_blank">Get-PSResourceString.ps1</a>.&nbsp; This is a simple utility script used to look up localized error messages, and it is used by <a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member</a>.</p>
<p>Here are the syntaxes supported by <a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member</a>:</p>
<p><a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member</a> [-include] &lt;string[]&gt; [-exclude &lt;string[]&gt;] [[-inputObject] &lt;psobject&gt;]<br /><a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member</a> -exclude &lt;string[]&gt; [[-inputObject] &lt;psobject&gt;]<br /><a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member</a> -reset [[-inputObject] &lt;psobject&gt;]
<p>The first variation allows you to specify which properties you want to include and optionally which properties you want to exclude.&nbsp; If you exclude properties, those will be removed only after the list of properties to include have been processed.&nbsp; Both the include and the exclude parameters support wildcards as well.</p>
<p>The second variation allows you to specify which properties you want to exclude from the default without including any parameters.</p>
<p>The last variation allows you to reset the object so that it will use the default property set as defined by the type data files and throw away any default property set that was added with <a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member</a>.</p>
<p>Here&#8217;s a screenshot showing some cool things you can do with this script and WMI objects:</p>
<p><a href="http://kirkmunro.files.wordpress.com/2008/07/image4.png" target="_blank"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="681" alt="image" src="http://kirkmunro.files.wordpress.com/2008/07/image-thumb4.png?w=404&#038;h=681" width="404" border="0"></a> </p>
<p>Here&#8217;s another screenshot showing how you can get better formatting on ADSI objects:</p>
<p><a href="http://kirkmunro.files.wordpress.com/2008/07/image5.png" target="_blank"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="194" alt="image" src="http://kirkmunro.files.wordpress.com/2008/07/image-thumb5.png?w=404&#038;h=194" width="404" border="0"></a> </p>
<p>Note that in both these examples, the value isn&#8217;t simply in being able to specify the defaults ad-hoc like this; format-table can allow you to specify which properties you see.&nbsp; The real value lies in writing scripts or functions that output objects already formatted a certain way.&nbsp; You could have a script that would set the default properties for a bunch of WMI objects you use, or a script that creates its own objects and outputs them with default properties defined.&nbsp; There are other opportunities with this cmdlet as well, but this should get you started.</p>
<p><strong>What&#8217;s missing from this?</strong></p>
<p>The Select-Member script doesn&#8217;t yet support specifying the parameter sort order, nor does it support specifying the single default parameter that is used when using wide format.&nbsp; These could be easily added in the future, and I will look into that as time permits.</p>
<p><strong>Give feedback!</strong></p>
<p>As with all scripts I write, I&#8217;d love to hear what you think.&nbsp; Whether you use the simple solution to specify default properties for custom objects or the more advanced <a title="Select-Member" href="http://cid-8d190219876b1dda.skydrive.live.com/self.aspx/PowerShell/Select-Member.ps1" target="_blank">Select-Member</a> script, let me know how well it works out for you.</p>
<p>Thanks,</p>
<p>Kirk out.</p>
<p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dc142665-5c96-4097-bf43-baa1dd46cfdc" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/Essential%20PowerShell" rel="tag">Essential PowerShell</a>,<a href="http://technorati.com/tags/Select-Member" rel="tag">Select-Member</a></div>
</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;title=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;;title=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;title=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;title=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;ti=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;title=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;title=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;title=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/&amp;t=Essential PowerShell: Define default properties for custom objects" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kirkmunro.wordpress.com/150/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kirkmunro.wordpress.com/150/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/150/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=150&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/V2W8lkhLG9E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2008/07/image-thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2008/07/image-thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2008/07/image-thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2008/07/image-thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2008/07/image-thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://kirkmunro.files.wordpress.com/2008/07/image-thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
		<item>
		<title>Essential PowerShell: Name your custom object types</title>
		<link>http://poshoholic.com/2008/07/03/essential-powershell-name-your-custom-object-types/</link>
		<comments>http://poshoholic.com/2008/07/03/essential-powershell-name-your-custom-object-types/#comments</comments>
		<pubDate>Fri, 04 Jul 2008 03:01:33 +0000</pubDate>
		<dc:creator>Kirk Munro</dc:creator>
				<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PoSh]]></category>
		<category><![CDATA[Poshoholic]]></category>

		<guid isPermaLink="false">http://kirkmunro.wordpress.com/2008/07/03/essential-powershell-name-your-custom-object-types/</guid>
		<description><![CDATA[PowerShell is a very flexible scripting language that allows users to dynamically create and/or extend objects with additional methods and properties.&#160; This is very useful when you&#8217;re trying to build up a rich data set with all of the properties or methods you need.&#160; One important thing that is often overlooked when people are writing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=135&subd=kirkmunro&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>PowerShell is a very flexible scripting language that allows users to dynamically create and/or extend objects with additional methods and properties.&nbsp; This is very useful when you&#8217;re trying to build up a rich data set with all of the properties or methods you need.&nbsp; One important thing that is often overlooked when people are writing scripts that do this is that they can also give those objects a type name.&nbsp; Why is this type name important?&nbsp; Three reasons:</p>
<ol>
<li>If you want to further extend those types automatically via a type data file, you&#8217;ll want a unique type name so that only the appropriate objects are extended.
<li>If you want to apply specific default custom formatting to those types via a format data file, you&#8217;ll want a unique name so that only the appropriate objects are formatted this way.
<li>If you want to associate specific links and actions with your custom object type in <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>, you&#8217;ll want a unique name so that you don&#8217;t get links and actions associated with other types.</li>
</ol>
<p>In practice there are only two use cases where I need to create a custom object type name, and I apply different names depending on the scenario I&#8217;m working with at the time.</p>
<p>If I have created a brand new generic PSObject, then I apply a name appropriate to the object.&nbsp; In this case, after I created my custom object and added the properties, I would do the following:</p>
<blockquote><p>$myObject.PSObject.TypeNames.Insert(0,&#8217;MyObjectTypeName&#8217;)</p>
</blockquote>
<p>Alternatively, if I am extending an object of a particular type, then I apply an extended type name for that object to the modified version.&nbsp; In this case, after I created my custom object and added the properties, I would do the following:</p>
<blockquote><p>$derivedTypeName = $myObject.PSObject.TypeNames[0]<br />$myObject.PSObject.TypeNames.Insert(0,&#8221;$derivedTypeName#MyExtensionName&#8221;)</p>
</blockquote>
<p>Then if you create type or format data files, you simply need to use your new type name in appropriate XML attribute to set up the association.&nbsp; Or if you&#8217;re adding functionality to <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a>, any links and actions you create will automatically be associated with the lowest derived object type, which will be the type name you applied to the object before outputting it in the <a title="PowerGUI" href="http://www.powergui.org" target="_blank">PowerGUI</a> data grid.</p>
<p>You can add as many type names as you want to your objects, so if you want to create a virtual object hierarchy with your custom object types, and then associate format or type data specifications with derived or base object types, you can do that as well through multiple calls to the Insert method on the TypeNames collection.&nbsp; This can be useful if you want to share a certain set of functionality between two types of objects you are creating but in addition you want some functionality to be specific to each type and you don&#8217;t want to duplicate code.</p>
<p>Hopefully this will encourage you to name your custom object types and define their default properties in scripts that you share with others.</p>
<p>If you&#8217;re working with custom objects you should also check out the follow-up post to this that resulted from Hal&#8217;s comments on this post, titled &#8220;<a title="Define default properties for custom objects" href="http://poshoholic.com/2008/07/05/essential-powershell-define-default-properties-for-custom-objects/">Essential PowerShell: Define default properties for custom objects</a>&#8220;.</p>
<p>Enjoy!</p>
<p>Kirk out.</p>
</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2ca0e0b5-7fc2-452e-8aa9-248c38b9f5c4" style="display:inline;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/PoSh" rel="tag">PoSh</a>,<a href="http://technorati.com/tags/Poshoholic" rel="tag">Poshoholic</a>,<a href="http://technorati.com/tags/PowerGUI" rel="tag">PowerGUI</a></div>
</p>
<p><span class="sbmLink"><br />
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post: </td>
<td class="sbmDim"><a class="sbmDim" title="Post it to blinkbits!" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://poshoholic.com/2008/07/03&amp;title=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://poshoholic.com/2008/07/03&amp;;title=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://poshoholic.com/2008/07/03&amp;title=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://poshoholic.com/2008/07/03&amp;title=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to furl" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://poshoholic.com/2008/07/03&amp;ti=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to reddit!" href="http://reddit.com/submit?url=http://poshoholic.com/2008/07/03&amp;title=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to spurl" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://poshoholic.com/2008/07/03&amp;title=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to technorati!" href="http://technorati.com/faves/?add=http://poshoholic.com/2008/07/03&amp;title=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"></a>
<td class="sbmDim"><a class="sbmDim" title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://poshoholic.com/2008/07/03&amp;t=Essential PowerShell: Name your custom object types" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"></a></td>
</tr>
</tbody>
</table>
<p></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kirkmunro.wordpress.com/135/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kirkmunro.wordpress.com/135/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kirkmunro.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kirkmunro.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kirkmunro.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kirkmunro.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kirkmunro.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kirkmunro.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kirkmunro.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kirkmunro.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kirkmunro.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kirkmunro.wordpress.com/135/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=poshoholic.com&blog=1436967&post=135&subd=kirkmunro&ref=&feed=1" /></div><img src="http://feeds.feedburner.com/~r/Poshoholic/~4/u77akto57Hw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://poshoholic.com/2008/07/03/essential-powershell-name-your-custom-object-types/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Poshoholic</media:title>
		</media:content>

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" medium="image" />

		<media:content url="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" medium="image" />
	</item>
	</channel>
</rss>
