<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Nivot Ink - Cmdlets</title>
    <link>http://www.nivot.org/</link>
    <description>PowerShell, SharePoint, WCF, WWF, .NET, ASP.NET, Enterprise Computing and babble from Microsoft MVP Oisin Grehan.</description>
    <language>en-us</language>
    <copyright>Oisin Grehan</copyright>
    <lastBuildDate>Mon, 26 Jul 2010 21:33:21 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>oising@gmail.com</managingEditor>
    <webMaster>oising@gmail.com</webMaster>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=0b623743-f07e-4fd4-891e-35a05c656c4a</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,0b623743-f07e-4fd4-891e-35a05c656c4a.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,0b623743-f07e-4fd4-891e-35a05c656c4a.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=0b623743-f07e-4fd4-891e-35a05c656c4a</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Write your own PowerShell provider using only script, no C# required. Module definition
is provided by a Windows PowerShell 2.0 Module, which may be pure script, binary or
a mix of both.
</p>
        <p>
Debugging is as easy as any ordinary ps1 script file:
</p>
        <p>
          <a href="http://www.nivot.org/content/binary/WindowsLiveWriter/869ac7ef36f5_F659/image_4.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/869ac7ef36f5_F659/image_thumb_1.png" width="846" height="654" />
          </a>
        </p>
        <p>
All functions in backing module reflect the same signature as those found on MSDN.
This means that you go to MSDN documentation on providers to learn about how to write
the corresponding script. 
</p>
        <h4>Current Release <a href="http://psprovider.codeplex.com/releases/view/49025">PSProvider
0.4</a></h4>
        <h4>Samples and Templates
</h4>
        <ul>
          <li>
See <a href="http://psprovider.codeplex.com/documentation?referringTitle=Home">Documentation</a></li>
        </ul>
        <h4>Roadmap
</h4>
        <h5>0.1
</h5>
        <ul>
          <li>
ContainerCmdletProvider support through "ModuleBoundProvider" provider 
</li>
          <li>
Demo provider included navigating a Hashtable 
</li>
          <li>
Can be debugged in the debugger of your choice: console, ISE, PowerGUI.</li>
        </ul>
        <h5>0.2
</h5>
        <ul>
          <li>
NavigationCmdletProvider support 
</li>
          <li>
Providers rename to ContainerScriptProvider and TreeScriptProvider 
</li>
          <li>
Container Sample &amp; Tree Template modules 
</li>
          <li>
Supports: <b>Clear-Item, Copy-Item, Get-Item, Invoke-Item, Move-Item, New-Item, Remove-Item,
Rename-Item, Set-Item</b></li>
        </ul>
        <h5>0.3
</h5>
        <ul>
          <li>
IContentCmdletProvider support 
</li>
          <li>
New Commands: <b>New-ContentReader, New-ContentWriter</b> implement IContentReader,
IContentWriter 
</li>
          <li>
Adds support for: <b>Add-Content, Clear-Content, Get-Content, Set-Content</b></li>
        </ul>
        <h5>0.4 (Current Release)
</h5>
        <ul>
          <li>
IPropertyCmdletProvider support 
</li>
          <li>
Adds support for: <b>Clear-ItemProperty, Copy-ItemProperty, Get-ItemProperty, Move-ItemProperty,
New-ItemProperty, Remove-ItemProperty, Rename-ItemProperty, Set-ItemProperty</b></li>
        </ul>
        <h5>0.5
</h5>
        <ul>
          <li>
Dynamic Parameter support</li>
        </ul>
        <h5>0.6
</h5>
        <ul>
          <li>
Security Interfaces 
</li>
          <li>
Adds support for: <b>Get-ACL, Set-ACL</b></li>
        </ul>
        <p>
          <a href="http://psprovider.codeplex.com/">http://psprovider.codeplex.com/</a>
        </p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=0b623743-f07e-4fd4-891e-35a05c656c4a" />
      </body>
      <title>PowerShell Script Provider</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,0b623743-f07e-4fd4-891e-35a05c656c4a.aspx</guid>
      <link>http://www.nivot.org/2010/07/26/PowerShellScriptProvider.aspx</link>
      <pubDate>Mon, 26 Jul 2010 21:33:21 GMT</pubDate>
      <description>&lt;p&gt;
Write your own PowerShell provider using only script, no C# required. Module definition
is provided by a Windows PowerShell 2.0 Module, which may be pure script, binary or
a mix of both.
&lt;/p&gt;
&lt;p&gt;
Debugging is as easy as any ordinary ps1 script file:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.nivot.org/content/binary/WindowsLiveWriter/869ac7ef36f5_F659/image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/869ac7ef36f5_F659/image_thumb_1.png" width="846" height="654"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
All functions in backing module reflect the same signature as those found on MSDN.
This means that you go to MSDN documentation on providers to learn about how to write
the corresponding script. 
&lt;/p&gt;
&lt;h4&gt;Current Release &lt;a href="http://psprovider.codeplex.com/releases/view/49025"&gt;PSProvider
0.4&lt;/a&gt;
&lt;/h4&gt;
&lt;h4&gt;Samples and Templates
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
See &lt;a href="http://psprovider.codeplex.com/documentation?referringTitle=Home"&gt;Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Roadmap
&lt;/h4&gt;
&lt;h5&gt;0.1
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
ContainerCmdletProvider support through "ModuleBoundProvider" provider 
&lt;li&gt;
Demo provider included navigating a Hashtable 
&lt;li&gt;
Can be debugged in the debugger of your choice: console, ISE, PowerGUI.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;0.2
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
NavigationCmdletProvider support 
&lt;li&gt;
Providers rename to ContainerScriptProvider and TreeScriptProvider 
&lt;li&gt;
Container Sample &amp;amp; Tree Template modules 
&lt;li&gt;
Supports: &lt;b&gt;Clear-Item, Copy-Item, Get-Item, Invoke-Item, Move-Item, New-Item, Remove-Item,
Rename-Item, Set-Item&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;0.3
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
IContentCmdletProvider support 
&lt;li&gt;
New Commands: &lt;b&gt;New-ContentReader, New-ContentWriter&lt;/b&gt; implement IContentReader,
IContentWriter 
&lt;li&gt;
Adds support for: &lt;b&gt;Add-Content, Clear-Content, Get-Content, Set-Content&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;0.4 (Current Release)
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
IPropertyCmdletProvider support 
&lt;li&gt;
Adds support for: &lt;b&gt;Clear-ItemProperty, Copy-ItemProperty, Get-ItemProperty, Move-ItemProperty,
New-ItemProperty, Remove-ItemProperty, Rename-ItemProperty, Set-ItemProperty&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;0.5
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
Dynamic Parameter support&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;0.6
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
Security Interfaces 
&lt;li&gt;
Adds support for: &lt;b&gt;Get-ACL, Set-ACL&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;a href="http://psprovider.codeplex.com/"&gt;http://psprovider.codeplex.com/&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=0b623743-f07e-4fd4-891e-35a05c656c4a" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,0b623743-f07e-4fd4-891e-35a05c656c4a.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>CodePlex</category>
      <category>Developer</category>
      <category>Modules</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>Providers</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=d23c0f43-6edf-44a0-8d04-8d768af8c122</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,d23c0f43-6edf-44a0-8d04-8d768af8c122.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,d23c0f43-6edf-44a0-8d04-8d768af8c122.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=d23c0f43-6edf-44a0-8d04-8d768af8c122</wfw:commentRss>
      <title>PowerShell 2.0 – PSCX Labs: Invoke-Reflector</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,d23c0f43-6edf-44a0-8d04-8d768af8c122.aspx</guid>
      <link>http://www.nivot.org/2010/05/05/PowerShell20PSCXLabsInvokeReflector.aspx</link>
      <pubDate>Wed, 05 May 2010 21:05:16 GMT</pubDate>
      <description>&lt;p&gt;
This is a lot of fun if you spend a lot of time tinkering around with APIs in PowerShell.
This function (included in the upcoming PSCX 2.0, alias: refl) will let you open Lutz
Roeder’s &lt;a href="http://www.red-gate.com/products/reflector/" target="_blank"&gt;Reflector&lt;/a&gt; for
any Type or Cmdlet. Reflector will automatically load the correct Assembly and will
highlight the relevant Type, without you having to do diddley-squat. Examples and
help will display with -?
&lt;/p&gt;
&lt;pre class="brush:powershell"&gt;
function Invoke-Reflector {

&lt;# .synopsis quickly load Reflector, with the specified Type or Command selected.
    .DESCRIPTION
        Quickly load Reflector, with the specified Type or Command selected. The function will also
        ensure that Reflector has the Type or Command's containing Assembly loaded.
    .EXAMPLE
        # Opens System.String in Reflector. Will load its Assembly into Reflector if required.
        ps&gt;
[string] | invoke-reflector .EXAMPLE # Opens GetChildItemCommand in Reflector. Will
load its Assembly into Reflector if required. ps&gt; gcm ls | invoke-reflector .EXAMPLE
# Opens GetChildItemCommand in Reflector. Will load its Assembly into Reflector if
required. ps&gt; invoke-reflector dir .PARAMETER CommandName Accepts name of command.
Does not accept pipeline input. .PARAMETER CommandInfo Accepts output from Get-Command
(gcm). Accepts pipeline input. .PARAMETER Type Accepts a System.Type (System.RuntimeType).
Accepts pipeline input. .PARAMETER ReflectorPath Optional. Defaults to Reflector.exe's
location if it is found in your $ENV:PATH. If not found, you must specify. .INPUTS
[System.Type] [System.Management.Automation.CommandInfo] .OUTPUTS None #&gt; [cmdletbinding(defaultparametersetname="name")]
param( [parameter( parametersetname="name", position=0, mandatory=$true )] [validatenotnullorempty()]
[string]$CommandName, [parameter( parametersetname="command", position=0, valuefrompipeline=$true,
mandatory=$true )] [validatenotnull()] [management.automation.commandinfo]$CommandInfo,
[parameter( parametersetname="type", position=0, valuefrompipeline=$true, mandatory=$true
)] [validatenotnull()] [type]$Type, [parameter( position=1 )] [validatenotnullorempty()]
[string]$ReflectorPath = $((gcm reflector.exe -ea 0).definition) ) # no process block;
i only want # a single reflector instance if ($ReflectorPath -and (test-path $reflectorpath))
{ $typeName = $null $assemblyLocation = $null switch ($pscmdlet.parametersetname)
{ { "name","command" -contains $_ } { if ($CommandName) { $CommandInfo = gcm $CommandName
-ea 0 } else { $CommandName = $CommandInfo.Name } if ($CommandInfo -is [management.automation.aliasinfo])
{ # expand aliases while ($CommandInfo.CommandType -eq "Alias") { $CommandInfo = gcm
$CommandInfo.Definition } } # can only reflect cmdlets, obviously. if ($CommandInfo.CommandType
-eq "Cmdlet") { $typeName = $commandinfo.implementingtype.fullname $assemblyLocation
= $commandinfo.implementingtype.assembly.location } elseif ($CommandInfo) { write-warning
"$CommandInfo is not a Cmdlet." } else { write-warning "Cmdlet $CommandName does not
exist in current scope. Have you loaded its containing module or snap-in?" } } "type"
{ $typeName = $type.fullname $assemblyLocation = $type.assembly.location } } # end
switch if ($typeName -and $assemblyLocation) { &amp; $reflectorPath /select:$typeName
$assemblyLocation } } else { write-warning "Unable to find Reflector.exe. Please specify
full path via -ReflectorPath." } } 
&lt;/pre&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=d23c0f43-6edf-44a0-8d04-8d768af8c122" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,d23c0f43-6edf-44a0-8d04-8d768af8c122.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>Developer</category>
      <category>Functions</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>PSCX</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=dc6c6638-cb87-4f78-8715-f221bbcc53c6</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,dc6c6638-cb87-4f78-8715-f221bbcc53c6.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,dc6c6638-cb87-4f78-8715-f221bbcc53c6.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=dc6c6638-cb87-4f78-8715-f221bbcc53c6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
These days I'm incredibly busy both in my professional and private life, so I’ve not
had a lot of time to construct the usual meaty posts I like to write. Instead I figured
I could write a series of short – very short – posts centered around the little tricks
that you would need to be an efficient developer when targeting PowerShell. Here's
the first tip: how to create a Runspace and have one or more Module(s) preloaded.
The <a href="http://msdn.microsoft.com/en-us/library/system.management.automation.runspaceinvoke.aspx" target="_blank">RunspaceInvoke</a> class
is a handy wrapper that will do most of the plumbing for you if you just want to run
scripts or commands. If you want to manually construct your own <a href="http://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.pipeline.aspx" target="_blank">Pipeline</a> instances
then you must work with the <a href="http://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.runspace.aspx" target="_blank">Runspace</a> class
directly.
</p>
        <pre class="brush:csharp">
    InitialSessionState initial = InitialSessionState.CreateDefault();
    initialSession.ImportPSModule(new[] { modulePathOrModuleName1, ... });
    Runspace runspace = RunspaceFactory.CreateRunspace(initial);
    runspace.Open();
    RunspaceInvoke invoker = new RunspaceInvoke(runspace);
    Collection&lt;PSObject&gt; results = invoker.Invoke("...");
</pre>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=dc6c6638-cb87-4f78-8715-f221bbcc53c6" />
      </body>
      <title>PowerShell 2.0 – Developer Essentials #1 – Initializing a Runspace with a Module</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,dc6c6638-cb87-4f78-8715-f221bbcc53c6.aspx</guid>
      <link>http://www.nivot.org/2010/05/03/PowerShell20DeveloperEssentials1InitializingARunspaceWithAModule.aspx</link>
      <pubDate>Mon, 03 May 2010 16:54:13 GMT</pubDate>
      <description>&lt;p&gt;
These days I'm incredibly busy both in my professional and private life, so I’ve not
had a lot of time to construct the usual meaty posts I like to write. Instead I figured
I could write a series of short – very short – posts centered around the little tricks
that you would need to be an efficient developer when targeting PowerShell. Here's
the first tip: how to create a Runspace and have one or more Module(s) preloaded.
The &lt;a href="http://msdn.microsoft.com/en-us/library/system.management.automation.runspaceinvoke.aspx" target="_blank"&gt;RunspaceInvoke&lt;/a&gt; class
is a handy wrapper that will do most of the plumbing for you if you just want to run
scripts or commands. If you want to manually construct your own &lt;a href="http://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.pipeline.aspx" target="_blank"&gt;Pipeline&lt;/a&gt; instances
then you must work with the &lt;a href="http://msdn.microsoft.com/en-us/library/system.management.automation.runspaces.runspace.aspx" target="_blank"&gt;Runspace&lt;/a&gt; class
directly.
&lt;/p&gt;
&lt;pre class="brush:csharp"&gt;
    InitialSessionState initial = InitialSessionState.CreateDefault();
    initialSession.ImportPSModule(new[] { modulePathOrModuleName1, ... });
    Runspace runspace = RunspaceFactory.CreateRunspace(initial);
    runspace.Open();
    RunspaceInvoke invoker = new RunspaceInvoke(runspace);
    Collection&amp;lt;PSObject&amp;gt; results = invoker.Invoke("...");
&lt;/pre&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=dc6c6638-cb87-4f78-8715-f221bbcc53c6" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,dc6c6638-cb87-4f78-8715-f221bbcc53c6.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>Developer</category>
      <category>Modules</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=d670cb31-373a-41bc-8633-c5d102fd308d</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,d670cb31-373a-41bc-8633-c5d102fd308d.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,d670cb31-373a-41bc-8633-c5d102fd308d.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=d670cb31-373a-41bc-8633-c5d102fd308d</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>PowerShell 2.0 – Partial Application of Functions and Cmdlets</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,d670cb31-373a-41bc-8633-c5d102fd308d.aspx</guid>
      <link>http://www.nivot.org/2010/03/11/PowerShell20PartialApplicationOfFunctionsAndCmdlets.aspx</link>
      <pubDate>Thu, 11 Mar 2010 01:01:07 GMT</pubDate>
      <description>&lt;p&gt;
This is unashamedly a post for developers, in particular those with an interest in
functional languages. With the advent of PowerShell 2.0, some of you may have noticed
that ScriptBlocks - which I suppose could also be called anonymous functions or lambdas
- gained a new method: &lt;a href="http://blogs.msdn.com/powershell/archive/2009/03/27/get-closure-with-getnewclosure.aspx" target="_blank"&gt;GetNewClosure&lt;/a&gt;.
Closures are one of the essential tools for functional programming., something I’ve
been trying to learn more about over the last few years. I don’t really have an opportunity
to use it in work other than the hybrid trickery available in C# 3.0, but I have been
tinkering a lot with PowerShell 2.0 to see if some of the tricks of the functional
trade could be implemented. It’s just a shell language, but there are some nice features
in there that enable a wide variety of funky stuff.
&lt;/p&gt;
&lt;h3&gt;Partial Application
&lt;/h3&gt;
&lt;p&gt;
In a nutshell, partial application of a function is when you pass in only some of
the parameters and get a function back that can accept the remaining parameters:
&lt;/p&gt;
&lt;pre class="brush:powershell"&gt;# define a simple function
function test {
    param($a, $b, $c);
    "a: $a; b: $b; c:$c"
}

# partially apply with -c parameter
$f = merge-parameter (gcm test) -c 5

# partially apply with -c and -a then execute with -b (papp is an alias)
&amp;amp; (papp (papp (gcm test) -c 3) -a 2) -b 7

# partially apply the get-command cmdlet with -commandtype
# and assign the result to a new function
si function:get-function (papp (gcm get-command) -commandtype function)
&lt;/pre&gt;
&lt;p&gt;
This is by no means a complete implementation of a partial application framework for
powershell. The merge-parameter function (aliased to papp) currently only works with
the default parameterset and does not mirror any of the parameteric attributes in
the applied function or cmdlet. I'm not saying it couldn't do that, but this is purely
a proof of concept. The module is listed below and is also available from PoshCode
at &lt;a href="http://poshcode.org/1687" target="_blank"&gt;http://poshcode.org/1687&lt;/a&gt; 
&lt;/p&gt;
&lt;pre class="brush:powershell"&gt;# save as functional.psm1 and drop into your module path
Set-StrictMode -Version 2

$commonParameters = @("Verbose",
                      "Debug",
                      "ErrorAction",
                      "WarningAction",
                      "ErrorVariable",
                      "WarningVariable",
                      "OutVariable",
                      "OutBuffer")

&amp;lt;#
.SYNOPSIS
    Support function for partially-applied cmdlets and functions.
#&amp;gt;
function Get-ParameterDictionary {
    [outputtype([Management.Automation.RuntimeDefinedParameterDictionary])]
    [cmdletbinding()]
    param(
        [validatenotnull()]
        [management.automation.commandinfo]$CommandInfo,
        [validatenotnull()]
        [management.automation.pscmdlet]$PSCmdletContext = $PSCmdlet
    )
    
    # dictionary to hold dynamic parameters
    $rdpd = new-object Management.Automation.RuntimeDefinedParameterDictionary

    try {
        # grab parameters from function
        if ($CommandInfo.parametersets.count &amp;gt; 1) {
            $parameters = $CommandInfo.ParameterSets[[string]$CommandInfo.DefaultParameterSet].parameters
        } else {
            $parameters = $CommandInfo.parameters.getenumerator() | % {$CommandInfo.parameters[$_.key]}
        }        
                
        $parameters | % {
            
            write-verbose "testing $($_.name)"
                                    
            # skip common parameters        
            if ($commonParameters -like $_.Name) {                                  
                
                write-verbose "skipping common parameter $($_.name)"
                
            } else {
                
                $rdp = new-object management.automation.runtimedefinedparameter
                $rdp.Name = $_.Name
                $rdp.ParameterType = $_.ParameterType
                
                # tag new parameters to match this function's parameterset
                $pa = new-object system.management.automation.parameterattribute
                $pa.ParameterSetName = $PSCmdletContext.ParameterSetName
                $rdp.Attributes.Add($pa)
                
                $rdpd.add($_.Name, $rdp)
            }
            
        }
    } catch {
    
        Write-Warning "Error getting parameter dictionary: $_"
    }
    
    # return
    $rdpd
}

&amp;lt;#
.SYNOPSIS
    Function that accepts a FunctionInfo or CmdletInfo reference and one or more parameters
    and returns a FunctionInfo bound to those parameter(s) and their value(s.)
.DESCRIPTION
    Function that accepts a FunctionInfo or CmdletInfo reference and one or more parameters
    and returns a FunctionInfo bound to those parameter(s) and their value(s.)
    
    Any parameters "merged" into the function are removed from the available parameters for
    future invocations. Multiple chained merge-parameter calls are permitted.
.EXAMPLE

    First, we define a simple function:
    
    function test {
        param($a, $b, $c, $d);
        "a: $a; b: $b; c:$c; d:$d"
    }
    
    Now we merge -b parameter into functioninfo with the static value of 5, returning a new
    functioninfo:
    
    ps&amp;gt; $x = merge-parameter (gcm test) -b 5
    
    We execute the new functioninfo with the &amp;amp; (call) operator, passing in the remaining 
    arguments:
    
    ps&amp;gt; &amp;amp; $x -a 2 -c 4 -d 9
    a: 2; b: 5; c: 4; d: 9
    
    Now we merge two new parameters in, -c with the value 3 and -d with 5:
    
    ps&amp;gt; $y = merge-parameter $x -c 3 -d 5
    
    Again we call $y with the remaining named parameter -a:
    
    ps&amp;gt; &amp;amp; $y -a 2
    a: 2; b: 5; c: 3; d: 5
.EXAMPLE

    Cmdlets can also be subject to partial application. In this case we create a new
    function with the returned functioninfo:
    
    ps&amp;gt; si function:get-function (merge-parameter (gcm get-command) -commandtype function)
    ps&amp;gt; get-function
    
&lt;lists  ?function? commandtype of commands all&gt;
.PARAMETER _CommandInfo The FunctionInfo or CmdletInfo into which to merge (apply)
parameter(s.) The parameter is named with a leading underscore character to prevent
parameter collisions when exposing the targetted command's parameters and dynamic
parameters. .INPUTS FunctionInfo or CmdletInfo .OUTPUTS FunctionInfo #&amp;gt; function
Merge-Parameter { [OutputType([Management.Automation.FunctionInfo])] [CmdletBinding()]
param( [parameter(position=0, mandatory=$true)] [validatenotnull()] [validatescript({
($_ -is [management.automation.functioninfo]) -or ` ($_ -is [management.automation.cmdletinfo])
})] [management.automation.commandinfo]$_Command ) dynamicparam { # strict mode compatible
check for parameter if ((test-path variable:_command)) { # attach input functioninfo's
parameters to self Get-ParameterDictionary $_Command $PSCmdlet } } begin { write-verbose
"merge-parameter: begin" # copy our bound parameters, except common ones $mergedParameters
= new-object 'collections.generic.dictionary[string,object]' $PSBoundParameters #
remove our parameters, leaving only target function/CommandInfo's args to curry in
$mergedParameters.remove("_Command") &amp;gt; $null # remove common parameters $commonParameters
| % { if ($mergedParameters.ContainsKey($_)) { $mergedParameters.Remove($_) &amp;gt; $null
} } } process { write-verbose "merge-parameter: process" # temporary function name
$temp = [guid]::NewGuid() $target = $_Command # splat our fixed named parameter(s)
and then splat remaining args $partial = { [cmdletbinding()] param() # begin dynamicparam
dynamicparam { $targetRdpd = Get-ParameterDictionary $target $PSCmdlet # remove fixed
parameters $mergedParameters.keys | % { $targetRdpd.remove($_) &amp;gt; $null } $targetRdpd
} begin { write-verbose "i have $($mergedParameters.count) fixed parameter(s)." write-verbose
"i have $($targetrdpd.count) remaining parameter(s)" } # end dynamicparam process
{ $boundParameters = $PSCmdlet.MyInvocation.BoundParameters # remove common parameters
(verbose, whatif etc) $commonParameters | % { if ($boundParameters.ContainsKey($_))
{ $boundParameters.Remove($_) &amp;gt; $null } } # invoke command with fixed parameters
and passed parameters (all named) . $target @mergedParameters @boundParameters if
($args) { write-warning "received $($args.count) arg(s) not part of function." } }
} # emit function/CommandInfo new-item -Path function:$temp -Value $partial.GetNewClosure()
} end { # cleanup rm function:$temp } } new-alias papp Merge-Parameter -force Export-ModuleMember
-Alias papp -Function Merge-Parameter, Get-ParameterDictionary 
&lt;/pre&gt;
&lt;p&gt;
Have fun[ctional]!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=d670cb31-373a-41bc-8633-c5d102fd308d" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,d670cb31-373a-41bc-8633-c5d102fd308d.aspx</comments>
      <category>Closures</category>
      <category>Cmdlets</category>
      <category>Functional Programming</category>
      <category>Functions</category>
      <category>Modules</category>
      <category>Monad</category>
      <category>PowerShell</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=c7d2809a-49cc-492c-88dc-1af937dd360a</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,c7d2809a-49cc-492c-88dc-1af937dd360a.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,c7d2809a-49cc-492c-88dc-1af937dd360a.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=c7d2809a-49cc-492c-88dc-1af937dd360a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Paths in PowerShell are tough to understand [at first.] PowerShell Paths - or PSPaths,
not to be confused with Win32 paths - in their absolute forms, come in two distinct
flavours:
</p>
        <ul>
          <li>
Provider-qualified: FileSystem::<strong>c:\temp\foo.txt</strong></li>
          <li>
Drive-qualified: c:\temp\foo.txt</li>
        </ul>
        <p>
It's very easy to get confused over provider-internal (The <a href="http://msdn.microsoft.com/en-us/library/system.management.automation.pathinfo.providerpath(VS.85).aspx" target="_blank">ProviderPath</a> property
of a resolved <a href="http://msdn.microsoft.com/en-us/library/system.management.automation.pathinfo(VS.85).aspx" target="_blank">PathInfo</a> –
and the bold portion of the provider-qualified path above) and drive-qualified paths
since they look the same if you look at the default FileSystem provider drives. That
is to say, the PSDrive has the same name (C) as the native backing store, the windows
filesystem (C). So, to make it easier for yourself to understand the differences,
create yourself a new PSDrive:
</p>
        <p>
ps c:\&gt; new-psdrive temp filesystem c:\temp\<br />
ps c:\&gt; cd temp:<br />
ps temp:\&gt;
</p>
        <p>
Now, let's look at this again:
</p>
        <ul>
          <li>
Provider-qualified: FileSystem::<strong>c:\temp\foo.txt</strong></li>
          <li>
Drive-qualified: temp:\foo.txt</li>
        </ul>
        <p>
A bit easier this time to see what’s different this time. The bold text to the right
of the provider name is the ProviderPath.
</p>
        <p>
So, your goals for writing a generalized provider-friendly Cmdlet (or advanced function)
that accepts paths are:
</p>
        <ul>
          <li>
Define a LiteralPath path parameter aliased to PSPath</li>
          <li>
Define a Path parameter (which will resolve wildcards / glob)</li>
          <li>
Assume you are receiving PSPaths, <strong>NOT</strong> native provider-paths</li>
        </ul>
        <p>
Point number three is especially important. Also, obviously LiteralPath and Path should
belong in mutually exclusive parameter sets. 
</p>
        <p>
          <strong>Relative Paths</strong>
        </p>
        <p>
A good question is: how do we deal with relative paths being passed to a Cmdlet. As
you should assume all paths being given to you are PSPaths,  let’s look at what
the Cmdlet below does:
</p>
        <p>
ps temp:\&gt; write-zip -literalpath foo.txt
</p>
        <p>
The command should assume foo.txt is in the current drive, so this should be resolved
immediately in the ProcessRecord or EndProcessing block like (using the scripting
API here to demo):
</p>
        <p>
$provider = $null;<br />
$drive = $null<br />
$providerPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("foo.txt",
[ref]$provider, [ref]$drive)<br /><br />
Now you everything you need to recreate the two absolute forms of PSPaths, and you
also have the native absolute ProviderPath. To create a provider-qualified PSPath
for foo.txt, use $provider.Name + “::” + $providerPath. If $drive is not null (your
current location might be provider-qualified in which case $drive will be null) then
you should use $drive.name + ":\" + $drive.CurrentLocation + "\" + "foo.txt" to get
a drive-qualified PSPath.
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=c7d2809a-49cc-492c-88dc-1af937dd360a" />
      </body>
      <title>PowerShell – The Patchwork of Paths, PSPaths and ProviderPaths</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,c7d2809a-49cc-492c-88dc-1af937dd360a.aspx</guid>
      <link>http://www.nivot.org/2010/03/05/PowerShellThePatchworkOfPathsPSPathsAndProviderPaths.aspx</link>
      <pubDate>Fri, 05 Mar 2010 06:02:31 GMT</pubDate>
      <description>&lt;p&gt;
Paths in PowerShell are tough to understand [at first.] PowerShell Paths - or PSPaths,
not to be confused with Win32 paths - in their absolute forms, come in two distinct
flavours:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Provider-qualified: FileSystem::&lt;strong&gt;c:\temp\foo.txt&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
Drive-qualified: c:\temp\foo.txt&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
It's very easy to get confused over provider-internal (The &lt;a href="http://msdn.microsoft.com/en-us/library/system.management.automation.pathinfo.providerpath(VS.85).aspx" target="_blank"&gt;ProviderPath&lt;/a&gt; property
of a resolved &lt;a href="http://msdn.microsoft.com/en-us/library/system.management.automation.pathinfo(VS.85).aspx" target="_blank"&gt;PathInfo&lt;/a&gt; –
and the bold portion of the provider-qualified path above) and drive-qualified paths
since they look the same if you look at the default FileSystem provider drives. That
is to say, the PSDrive has the same name (C) as the native backing store, the windows
filesystem (C). So, to make it easier for yourself to understand the differences,
create yourself a new PSDrive:
&lt;/p&gt;
&lt;p&gt;
ps c:\&amp;gt; new-psdrive temp filesystem c:\temp\&lt;br&gt;
ps c:\&amp;gt; cd temp:&lt;br&gt;
ps temp:\&amp;gt;
&lt;/p&gt;
&lt;p&gt;
Now, let's look at this again:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Provider-qualified: FileSystem::&lt;strong&gt;c:\temp\foo.txt&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
Drive-qualified: temp:\foo.txt&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
A bit easier this time to see what’s different this time. The bold text to the right
of the provider name is the ProviderPath.
&lt;/p&gt;
&lt;p&gt;
So, your goals for writing a generalized provider-friendly Cmdlet (or advanced function)
that accepts paths are:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Define a LiteralPath path parameter aliased to PSPath&lt;/li&gt;
&lt;li&gt;
Define a Path parameter (which will resolve wildcards / glob)&lt;/li&gt;
&lt;li&gt;
Assume you are receiving PSPaths, &lt;strong&gt;NOT&lt;/strong&gt; native provider-paths&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Point number three is especially important. Also, obviously LiteralPath and Path should
belong in mutually exclusive parameter sets. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Relative Paths&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
A good question is: how do we deal with relative paths being passed to a Cmdlet. As
you should assume all paths being given to you are PSPaths,&amp;nbsp; let’s look at what
the Cmdlet below does:
&lt;/p&gt;
&lt;p&gt;
ps temp:\&amp;gt; write-zip -literalpath foo.txt
&lt;/p&gt;
&lt;p&gt;
The command should assume foo.txt is in the current drive, so this should be resolved
immediately in the ProcessRecord or EndProcessing block like (using the scripting
API here to demo):
&lt;/p&gt;
&lt;p&gt;
$provider = $null;&lt;br&gt;
$drive = $null&lt;br&gt;
$providerPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("foo.txt",
[ref]$provider, [ref]$drive)&lt;br&gt;
&lt;br&gt;
Now you everything you need to recreate the two absolute forms of PSPaths, and you
also have the native absolute ProviderPath. To create a provider-qualified PSPath
for foo.txt, use $provider.Name + “::” + $providerPath. If $drive is not null (your
current location might be provider-qualified in which case $drive will be null) then
you should use $drive.name + ":\" + $drive.CurrentLocation + "\" + "foo.txt" to get
a drive-qualified PSPath.
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=c7d2809a-49cc-492c-88dc-1af937dd360a" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,c7d2809a-49cc-492c-88dc-1af937dd360a.aspx</comments>
      <category>Cmdlets</category>
      <category>Functions</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>PSPath</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=a10ddb33-447c-4f5d-a9f5-aef32b8fc008</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,a10ddb33-447c-4f5d-a9f5-aef32b8fc008.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,a10ddb33-447c-4f5d-a9f5-aef32b8fc008.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=a10ddb33-447c-4f5d-a9f5-aef32b8fc008</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Did you know that when you run Get-Help against a cmdlet to find out about its parameters,
you might not be getting the whole truth? Certain cmdlets, especially those that operate
on providers (FileSystem, Certificate, Registry etc) can adopt new parameters on the
fly, depending on the path they are acting on. For example, when use you Get-Content
on the file system (drive c: etc), it gets three new parameters in addition to the
static ones listed by Get-Help (but more about this later): Delimiter, Encoding and
Wait. 
</p>
        <h4>Determining Dynamic Parameters using Get-Help
</h4>
        <p>
Get-Help has a new parameter, –Path, which lets you give the help system some context
for determining dynamic parameters:
</p>
        <blockquote>
          <i>
            <p>
-Path &lt;string&gt;<br />
    Gets help that explains how the cmdlet works in the specified provider
path. Enter a Windows PowerShell provider path. 
</p>
            <p>
    This parameter gets a customized version of a cmdlet help topic
that explains how the cmdlet works in the specified Windows PowerShell provider path.
This parameter is effective only for help about a provider cmdlet and only when the
provider includes a custom version of the provider cmdlet help topic. 
</p>
            <p>
    To see the custom cmdlet help for a provider path, go to the provider
path location and enter a Get-Help command or, from any path location, use the Path
parameter of Get-Help to specify the provider path. For more information, see about_Providers.
</p>
          </i>
        </blockquote>
        <h4>Determining Dynamic Parameters using Get-Command
</h4>
        <p>
Get-Command has a new parameter, –ArgumentList, which acts similarly to unveil what
dynamic parameters might be attached to a cmdlet for a given parameterset and path/literalpath
if available on the chosen cmdlet. I’ve written a simple function that takes a cmdlet
name as an argument and will display all of the dynamic parameters available for a
cmdlet for each distinct provider:
</p>
        <pre class="brush:powershell"># this function will pass a drive name in position 0 as an unnamed argument
# most path-oriented cmdlets accept this binding
function Get-DynamicParameter {
    param(        
        [string]$command
    ) 
  
    $parameters = @{}
    get-psdrive | sort -unique provider | % {
        $parameters[$_.provider.name] = gcm $command -args "$($_.name):" | % {
            $c = $_; @($_.parameters.keys) | sort | ? {
                $c.parameters[$_].isdynamic
            }
        }
    }
    $parameters    
}</pre>
        <p>
Example use:
</p>
        <pre style="font-family: courier; font-size: 11pt">PS&gt; Get-DynamicParameter get-content

Name                           Value
----                           -----
Alias
FileSystem                     {Delimiter, Encoding, Wait}
AssemblyCache
Registry
Environment
WSMan
Certificate
FeedStore
Function
Variable
PscxSettings</pre>
        <p>
          <strong>NOTE: </strong>when you don’t pass any context parameters to get-command via
–argumentlist, it will take your current location as the context for dynamic parameters
(if any are found.) So running get-command from c:\ instead hklm:\ will give you the
additional parameters Delimiter, Encoding and Wait.
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=a10ddb33-447c-4f5d-a9f5-aef32b8fc008" />
      </body>
      <title>PowerShell 2.0 - About Dynamic Parameters</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,a10ddb33-447c-4f5d-a9f5-aef32b8fc008.aspx</guid>
      <link>http://www.nivot.org/2010/01/18/PowerShell20AboutDynamicParameters.aspx</link>
      <pubDate>Mon, 18 Jan 2010 02:33:04 GMT</pubDate>
      <description>&lt;p&gt;
Did you know that when you run Get-Help against a cmdlet to find out about its parameters,
you might not be getting the whole truth? Certain cmdlets, especially those that operate
on providers (FileSystem, Certificate, Registry etc) can adopt new parameters on the
fly, depending on the path they are acting on. For example, when use you Get-Content
on the file system (drive c: etc), it gets three new parameters in addition to the
static ones listed by Get-Help (but more about this later): Delimiter, Encoding and
Wait. 
&lt;/p&gt;
&lt;h4&gt;Determining Dynamic Parameters using Get-Help
&lt;/h4&gt;
&lt;p&gt;
Get-Help has a new parameter, –Path, which lets you give the help system some context
for determining dynamic parameters:
&lt;/p&gt;
&lt;blockquote&gt;&lt;i&gt; 
&lt;p&gt;
-Path &amp;lt;string&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Gets help that explains how the cmdlet works in the specified provider
path. Enter a Windows PowerShell provider path. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; This parameter gets a customized version of a cmdlet help topic
that explains how the cmdlet works in the specified Windows PowerShell provider path.
This parameter is effective only for help about a provider cmdlet and only when the
provider includes a custom version of the provider cmdlet help topic. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; To see the custom cmdlet help for a provider path, go to the provider
path location and enter a Get-Help command or, from any path location, use the Path
parameter of Get-Help to specify the provider path. For more information, see about_Providers.
&lt;/p&gt;
&lt;/i&gt;&lt;/blockquote&gt; 
&lt;h4&gt;Determining Dynamic Parameters using Get-Command
&lt;/h4&gt;
&lt;p&gt;
Get-Command has a new parameter, –ArgumentList, which acts similarly to unveil what
dynamic parameters might be attached to a cmdlet for a given parameterset and path/literalpath
if available on the chosen cmdlet. I’ve written a simple function that takes a cmdlet
name as an argument and will display all of the dynamic parameters available for a
cmdlet for each distinct provider:
&lt;/p&gt;
&lt;pre class="brush:powershell"&gt;# this function will pass a drive name in position 0 as an unnamed argument
# most path-oriented cmdlets accept this binding
function Get-DynamicParameter {
    param(        
        [string]$command
    ) 
  
    $parameters = @{}
    get-psdrive | sort -unique provider | % {
        $parameters[$_.provider.name] = gcm $command -args "$($_.name):" | % {
            $c = $_; @($_.parameters.keys) | sort | ? {
                $c.parameters[$_].isdynamic
            }
        }
    }
    $parameters    
}&lt;/pre&gt;
&lt;p&gt;
Example use:
&lt;/p&gt;
&lt;pre style="font-family: courier; font-size: 11pt"&gt;PS&amp;gt; Get-DynamicParameter get-content

Name                           Value
----                           -----
Alias
FileSystem                     {Delimiter, Encoding, Wait}
AssemblyCache
Registry
Environment
WSMan
Certificate
FeedStore
Function
Variable
PscxSettings&lt;/pre&gt;
&lt;p&gt;
&lt;strong&gt;NOTE: &lt;/strong&gt;when you don’t pass any context parameters to get-command via
–argumentlist, it will take your current location as the context for dynamic parameters
(if any are found.) So running get-command from c:\ instead hklm:\ will give you the
additional parameters Delimiter, Encoding and Wait.
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=a10ddb33-447c-4f5d-a9f5-aef32b8fc008" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,a10ddb33-447c-4f5d-a9f5-aef32b8fc008.aspx</comments>
      <category>Cmdlets</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>Providers</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=7b7a72ad-28d7-4a61-a5a1-3729cae67bd3</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,7b7a72ad-28d7-4a61-a5a1-3729cae67bd3.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,7b7a72ad-28d7-4a61-a5a1-3729cae67bd3.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=7b7a72ad-28d7-4a61-a5a1-3729cae67bd3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>( from: </em>
          <a title="http://support.microsoft.com/default.aspx/kb/968929" href="http://support.microsoft.com/default.aspx/kb/968929">
            <em>http://support.microsoft.com/default.aspx/kb/968929</em>
          </a>
          <em> –
downloads at foot of page )</em>
        </p>
        <p>
Windows PowerShell is a command-line shell and scripting language that is designed
for system administration and Automation. Built on the Microsoft .NET Framework, Windows
PowerShell enables IT professionals and developers to control and automate the administration
of Windows and applications.
</p>
        <p>
New features that are introduced in Windows PowerShell 2.0 include the following: 
</p>
        <ul>
          <li>
            <b>Remoting</b>
            <br />
Windows PowerShell 2.0 lets you run commands on one or more remote computers from
a single computer that is running Windows PowerShell. PowerShell remoting allows for
multiple ways of connecting. These ways include interactive (1:1), fan-out (1:many),
and fan-in (many:1 by using the IIS hosting model). 
</li>
          <li>
            <b>Integrated Scripting Environment</b>
            <br />
PowerShell Integrated Scripting Environment (ISE) enables you to run interactive commands
and edit and debug scripts in a graphical environment. The main features include color-coded
syntax, selective execution, graphical debugging, Unicode support, and context-sensitive
help. 
</li>
          <li>
            <b>Modules</b>
            <br />
Modules allow for script developers and administrators to partition and organize their
Windows PowerShell code in self-contained, reusable units. Code from a module executes
in its own self-contained context and does not affect the state outside the module. 
</li>
          <li>
            <b>Advanced functions</b>
            <br />
Advanced functions are functions that have the same capabilities and behavior as cmdlets.
However, they are written completely in the Windows PowerShell language, instead of
compiled C#. 
</li>
          <li>
            <b>Background jobs</b>
            <br />
Windows PowerShell 2.0 allows for running a command or expression asynchronously and
"in the background" without interacting with the console. 
</li>
          <li>
            <b>Eventing</b>
            <br />
This feature adds support to the Windows PowerShell engine infrastructure for listening,
forwarding, and acting on management and system events. 
</li>
          <li>
            <b>Script internationalization</b>
            <br />
This new feature enables Windows PowerShell scripts to display messages in the spoken
language that is specified by the UI culture setting on the user's computer. 
</li>
          <li>
            <b>Script debugging</b>
            <br />
New debugging features were added to Windows PowerShell that let you set breakpoints
on lines, columns, variables, and commands, and that let you specify the action that
occurs when the breakpoint is hit. 
</li>
          <li>
            <b>New cmdlets</b>
            <br />
Windows PowerShell 2.0 introduces over 100 built-in cmdlets. These cmdlets, excluding
other tasks, enables you to do computer-related, event log, and performance counter
management tasks.</li>
        </ul>
        <h3>WinRM 2.0
</h3>
        <p>
WinRM is the Microsoft implementation of WS-Management Protocol, a standard Simple
Object Access Protocol (SOAP)–based, firewall-friendly protocol that allows for hardware
and operating systems from different vendors to interoperate. The WS-Management Protocol
specification provides a common way for systems to access and exchange management
information across an IT infrastructure.
</p>
        <p>
WinRM 2.0 includes the following new features: 
</p>
        <ul>
          <li>
The WinRM Client Shell API provides functionality to create and manage shells and
shell operations, commands, and data streams on remote computers. 
</li>
          <li>
The WinRM Plug-in API provides functionality that enables a user to write plug-ins
by implementing certain APIs for supported resources and operations. 
</li>
          <li>
WinRM 2.0 introduces a hosting framework. Two hosting models are supported. One is
Internet Information Services (IIS)-based and the other is WinRM service-based. 
</li>
          <li>
Association traversal lets a user retrieve instances of Association classes by using
a standard filtering mechanism. 
</li>
          <li>
WinRM 2.0 supports delegating user credentials across multiple remote computers. 
</li>
          <li>
Users of WinRM 2.0 can use Windows PowerShell cmdlets for system management. 
</li>
          <li>
WinRM has added a specific set of quotas that provide a better quality of service
and allocate server resources to concurrent users. The WinRM quota set is based on
the quota infrastructure that is implemented for the IIS service.</li>
        </ul>
        <h3>System requirements
</h3>
        <p>
          <strong>WinRM 2.0</strong> and <strong>PowerShell 2.0</strong> can be installed on
the following supported operating systems: 
</p>
        <ul>
          <li>
Windows Server 2008 with Service Pack 2 
</li>
          <li>
Windows Server 2003 with Service Pack 2 
</li>
          <li>
Windows Vista with Service Pack 2 
</li>
          <li>
Windows Vista with Service Pack 1 
</li>
          <li>
Windows XP with Service Pack 3</li>
        </ul>
Windows PowerShell 2.0 requires the Microsoft .NET Framework 2.0 with Service Pack
1. 
<p><strong>BITS 4.0</strong></p>
BITS 4.0 can be installed on the following supported operating systems: 
<ul><li>
Windows Server 2008 with Service Pack 2 
</li><li>
Windows Vista with Service Pack 2 
</li><li>
Windows Vista with Service Pack 1</li></ul><img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=7b7a72ad-28d7-4a61-a5a1-3729cae67bd3" /></body>
      <title>PowerShell 2.0 goes RTM for ALL Platforms</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,7b7a72ad-28d7-4a61-a5a1-3729cae67bd3.aspx</guid>
      <link>http://www.nivot.org/2009/10/28/PowerShell20GoesRTMForALLPlatforms.aspx</link>
      <pubDate>Wed, 28 Oct 2009 14:27:29 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;( from: &lt;/em&gt;&lt;a title="http://support.microsoft.com/default.aspx/kb/968929" href="http://support.microsoft.com/default.aspx/kb/968929"&gt;&lt;em&gt;http://support.microsoft.com/default.aspx/kb/968929&lt;/em&gt;&lt;/a&gt;&lt;em&gt; –
downloads at foot of page )&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
Windows PowerShell is a command-line shell and scripting language that is designed
for system administration and Automation. Built on the Microsoft .NET Framework, Windows
PowerShell enables IT professionals and developers to control and automate the administration
of Windows and applications.
&lt;/p&gt;
&lt;p&gt;
New features that are introduced in Windows PowerShell 2.0 include the following: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;Remoting&lt;/b&gt;
&lt;br&gt;
Windows PowerShell 2.0 lets you run commands on one or more remote computers from
a single computer that is running Windows PowerShell. PowerShell remoting allows for
multiple ways of connecting. These ways include interactive (1:1), fan-out (1:many),
and fan-in (many:1 by using the IIS hosting model). 
&lt;li&gt;
&lt;b&gt;Integrated Scripting Environment&lt;/b&gt;
&lt;br&gt;
PowerShell Integrated Scripting Environment (ISE) enables you to run interactive commands
and edit and debug scripts in a graphical environment. The main features include color-coded
syntax, selective execution, graphical debugging, Unicode support, and context-sensitive
help. 
&lt;li&gt;
&lt;b&gt;Modules&lt;/b&gt;
&lt;br&gt;
Modules allow for script developers and administrators to partition and organize their
Windows PowerShell code in self-contained, reusable units. Code from a module executes
in its own self-contained context and does not affect the state outside the module. 
&lt;li&gt;
&lt;b&gt;Advanced functions&lt;/b&gt;
&lt;br&gt;
Advanced functions are functions that have the same capabilities and behavior as cmdlets.
However, they are written completely in the Windows PowerShell language, instead of
compiled C#. 
&lt;li&gt;
&lt;b&gt;Background jobs&lt;/b&gt;
&lt;br&gt;
Windows PowerShell 2.0 allows for running a command or expression asynchronously and
"in the background" without interacting with the console. 
&lt;li&gt;
&lt;b&gt;Eventing&lt;/b&gt;
&lt;br&gt;
This feature adds support to the Windows PowerShell engine infrastructure for listening,
forwarding, and acting on management and system events. 
&lt;li&gt;
&lt;b&gt;Script internationalization&lt;/b&gt;
&lt;br&gt;
This new feature enables Windows PowerShell scripts to display messages in the spoken
language that is specified by the UI culture setting on the user's computer. 
&lt;li&gt;
&lt;b&gt;Script debugging&lt;/b&gt;
&lt;br&gt;
New debugging features were added to Windows PowerShell that let you set breakpoints
on lines, columns, variables, and commands, and that let you specify the action that
occurs when the breakpoint is hit. 
&lt;li&gt;
&lt;b&gt;New cmdlets&lt;/b&gt;
&lt;br&gt;
Windows PowerShell 2.0 introduces over 100 built-in cmdlets. These cmdlets, excluding
other tasks, enables you to do computer-related, event log, and performance counter
management tasks.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;WinRM 2.0
&lt;/h3&gt;
&lt;p&gt;
WinRM is the Microsoft implementation of WS-Management Protocol, a standard Simple
Object Access Protocol (SOAP)–based, firewall-friendly protocol that allows for hardware
and operating systems from different vendors to interoperate. The WS-Management Protocol
specification provides a common way for systems to access and exchange management
information across an IT infrastructure.
&lt;/p&gt;
&lt;p&gt;
WinRM 2.0 includes the following new features: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
The WinRM Client Shell API provides functionality to create and manage shells and
shell operations, commands, and data streams on remote computers. 
&lt;li&gt;
The WinRM Plug-in API provides functionality that enables a user to write plug-ins
by implementing certain APIs for supported resources and operations. 
&lt;li&gt;
WinRM 2.0 introduces a hosting framework. Two hosting models are supported. One is
Internet Information Services (IIS)-based and the other is WinRM service-based. 
&lt;li&gt;
Association traversal lets a user retrieve instances of Association classes by using
a standard filtering mechanism. 
&lt;li&gt;
WinRM 2.0 supports delegating user credentials across multiple remote computers. 
&lt;li&gt;
Users of WinRM 2.0 can use Windows PowerShell cmdlets for system management. 
&lt;li&gt;
WinRM has added a specific set of quotas that provide a better quality of service
and allocate server resources to concurrent users. The WinRM quota set is based on
the quota infrastructure that is implemented for the IIS service.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;System requirements
&lt;/h3&gt;
&lt;p&gt;
&lt;strong&gt;WinRM 2.0&lt;/strong&gt; and &lt;strong&gt;PowerShell 2.0&lt;/strong&gt; can be installed on
the following supported operating systems: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Windows Server 2008 with Service Pack 2 
&lt;li&gt;
Windows Server 2003 with Service Pack 2 
&lt;li&gt;
Windows Vista with Service Pack 2 
&lt;li&gt;
Windows Vista with Service Pack 1 
&lt;li&gt;
Windows XP with Service Pack 3&lt;/li&gt;
&lt;/ul&gt;
Windows PowerShell 2.0 requires the Microsoft .NET Framework 2.0 with Service Pack
1. 
&lt;p&gt;
&lt;strong&gt;BITS 4.0&lt;/strong&gt;
&lt;/p&gt;
BITS 4.0 can be installed on the following supported operating systems: 
&lt;ul&gt;
&lt;li&gt;
Windows Server 2008 with Service Pack 2 
&lt;li&gt;
Windows Vista with Service Pack 2 
&lt;li&gt;
Windows Vista with Service Pack 1&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=7b7a72ad-28d7-4a61-a5a1-3729cae67bd3" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,7b7a72ad-28d7-4a61-a5a1-3729cae67bd3.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>Microsoft</category>
      <category>Modules</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=d1ecaa42-6645-4ada-a827-6ae717b338ad</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,d1ecaa42-6645-4ada-a827-6ae717b338ad.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,d1ecaa42-6645-4ada-a827-6ae717b338ad.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=d1ecaa42-6645-4ada-a827-6ae717b338ad</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <i>
            <b>update</b>: missing backtick ` to escape the $verbosepreference variable</i>
        </p>
        <p>
A question came up on <a href=" http://www.stackoverflow.com/" target="_blank">stack
overflow</a> (you don’t know what that is? shame on you!) today from someone asking
how they could capture the Verbose stream from a pipeline they ran in a C# program.
As it turns out, the same technique is used in script, so I’ll give that example instead
since I’m sure the C# guys and gals will have no problem converting the script. 
</p>
        <p>
The key is using the new (to v2.0) System.Management.Automation.<a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a> Type,
which has a built-in Type Accelerator of [powershell]. It has a static method, Create,
which is used to create an instance. This instance is pretty much ready to roll. It
has a Streams property, which is of Type PSDataStreams. This Type has properties representing
each collection of Error, Progress, Verbose, Debug and Warning.
</p>
        <pre class="brush: powershell">
$ps = [powershell]::create()
$ps.Commands.AddScript("`$verbosepreference='continue'; write-verbose 42")
$ps.invoke()
$ps.streams.verbose
</pre>
Which yields the VerboseRecord that was written out: <pre>
Message InvocationInfo                              PipelineIterationInfo
------- --------------                              ---------------------
42      System.Management.Automation.InvocationInfo {0, 0}
</pre>
What's important to note about the above example is that I had to set the $verbosepreference
to at least "continue" (the default is silentlycontinue) in order for the verbose
record to be written. Have fun! <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=d1ecaa42-6645-4ada-a827-6ae717b338ad" /></body>
      <title>PowerShell 2.0: Quick Tip – Capture Verbose, Error &amp; Warning Streams</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,d1ecaa42-6645-4ada-a827-6ae717b338ad.aspx</guid>
      <link>http://www.nivot.org/2009/07/18/PowerShell20QuickTipCaptureVerboseErrorWarningStreams.aspx</link>
      <pubDate>Sat, 18 Jul 2009 04:02:53 GMT</pubDate>
      <description>&lt;p&gt;
&lt;i&gt;&lt;b&gt;update&lt;/b&gt;: missing backtick ` to escape the $verbosepreference variable&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
A question came up on &lt;a href=" http://www.stackoverflow.com/" target="_blank"&gt;stack
overflow&lt;/a&gt; (you don’t know what that is? shame on you!) today from someone asking
how they could capture the Verbose stream from a pipeline they ran in a C# program.
As it turns out, the same technique is used in script, so I’ll give that example instead
since I’m sure the C# guys and gals will have no problem converting the script. 
&lt;/p&gt;
&lt;p&gt;
The key is using the new (to v2.0) System.Management.Automation.&lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;PowerShell&lt;/a&gt; Type,
which has a built-in Type Accelerator of [powershell]. It has a static method, Create,
which is used to create an instance. This instance is pretty much ready to roll. It
has a Streams property, which is of Type PSDataStreams. This Type has properties representing
each collection of Error, Progress, Verbose, Debug and Warning.
&lt;/p&gt;
&lt;pre class="brush: powershell"&gt;
$ps = [powershell]::create()
$ps.Commands.AddScript("`$verbosepreference='continue'; write-verbose 42")
$ps.invoke()
$ps.streams.verbose
&lt;/pre&gt;
Which yields the VerboseRecord that was written out: &lt;pre&gt;
Message InvocationInfo                              PipelineIterationInfo
------- --------------                              ---------------------
42      System.Management.Automation.InvocationInfo {0, 0}
&lt;/pre&gt;
What's important to note about the above example is that I had to set the $verbosepreference
to at least "continue" (the default is silentlycontinue) in order for the verbose
record to be written. Have fun! &lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=d1ecaa42-6645-4ada-a827-6ae717b338ad" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,d1ecaa42-6645-4ada-a827-6ae717b338ad.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>RC</category>
      <category>Windows 7</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=f789804c-5a35-4d5c-a303-d1a2bdc6bbc0</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,f789804c-5a35-4d5c-a303-d1a2bdc6bbc0.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,f789804c-5a35-4d5c-a303-d1a2bdc6bbc0.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=f789804c-5a35-4d5c-a303-d1a2bdc6bbc0</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>
            <strong>update #1 2009/5/23</strong>: noted that local jobs (start-job) no longer
require an elevated shell.</em>
        </p>
        <p>
          <em>
            <strong>update #2 2009/5/28:</strong> ISE object model and shortcut changes; update
for set-psessionconfiguration cmdlet (new screenshot); module changes (highlighted
new manifest member names, binary module can now be root module); </em>
        </p>
        <p>
I’ve been meaning to write this for a while, but it’s been a busy time. This is a
comparison of the significant differences between the standalone CTP3 or Windows 7
Beta version and the version that comes with Win7 RC (6.1.7100.0). For all intents
and purposes, the CTP3 version (6.1.6469.0) is <em>exactly</em> the same as the Windows
7 Beta (6.1.7000.0) version.
</p>
        <p>
This is not going to be an exhaustive list of differences, but I will continue to
update this post as I find more things worth documenting. It should be safe to bookmark
the permalink. One of the nicest things about this release is that it appears that,
without exception, <strong>all built-in Cmdlets have help.</strong> A lot of things
have been cleaned up and fixed in this build, from formatting of text to typos and
minor bugs/glitches. 
</p>
        <h4>Cmdlet Differences
</h4>
        <p>
This is a table listing Cmdlets that have either <span class="changed">changed</span> (navy),
been <span class="added">added</span> (green, underlined) or <span class="removed">removed</span> (red,
strike-through.) Changed Cmdlets have their parameters listed in the second column.
A changed parameter means that its Type has been changed; e.g. it accepts a different
.NET object than before. This is generally nothing to worry about since the corresponding
source of such objects is usually changed to match – typically another Cmdlet. Parameters 
and Cmdlets that have not changed, are not listed. 
</p>
        <p>
          <style type="text/css">
            <!--
        #tbl td
        {
            vertical-align: top;
            font-size: 10pt;
        }
        .added
        {
            color: green;
            text-decoration: underline;
        }
        .removed
        {
            color: red;
            text-decoration: line-through;
        }
        .changed
        {
            color: navy;
        }
        .cmdlet
        {
            font-weight: bold;
            cursor: hand;
        }
        .param
        {
            font-style: italic;
            text-align: left;
        }
        .style1
        {
            width: 19px;
        }
    -->
          </style>
          <table id="tbl" border="1" width="600">
            <thead>
              <tr>
                <th>
Cmdlet</th>
                <th>
Parameters</th>
              </tr>
            </thead>
            <tbody>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Invoke-Command 
</td>
                <td>
                  <table id="pInvoke-Command" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="param removed">
NoCompression 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="param changed">
Session 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="param changed">
SessionOption 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="changed cmdlet">
Remove-Computer 
</td>
                <td>
                  <table id="pRemove-Computer" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
Force 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
Reboot 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
ComputerName 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Add-Computer 
</td>
                <td>
                  <table id="pAdd-Computer" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
ComputerName 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
Reboot 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="removed cmdlet">
Rename-Computer 
</td>
                <td>
                </td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Test-Connection 
</td>
                <td>
                  <table id="pTest-Connection" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
ComputerName 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
Quiet 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
Destination 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="changed cmdlet">
Export-FormatData 
</td>
                <td>
                  <table id="pExport-FormatData" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
 </td>
                        <td class="added param">
Path 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
FilePath 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Receive-Job 
</td>
                <td>
                  <table id="pReceive-Job" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="param changed">
Session 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="changed cmdlet">
Start-Job 
</td>
                <td>
                  <table id="pStart-Job" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
InitializationScript 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
RunAs32 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
ConfigurationName 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
CertificateThumbprint 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
NoCompression 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Get-Module 
</td>
                <td>
                  <table id="pGet-Module" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
Recurse 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="changed cmdlet">
New-ModuleManifest 
</td>
                <td>
                  <table id="pNew-ModuleManifest" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
ProcessorArchitecture 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
DotNetFrameworkVersion 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
PowerShellHostName 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
PowerShellHostVersion 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
FileList 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
ModuleList 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
FunctionsToExport 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
AliasesToExport 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
VariablesToExport 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
CmdletsToExport 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
OtherFiles 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
ExportedFunctions 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
ExportedAliases 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
ExportedVariables 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
ExportedCmdlets 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="param changed">
RequiredModules 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Set-PSBreakpoint 
</td>
                <td>
                  <table id="pSet-PSBreakpoint" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="param changed">
Script 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="added cmdlet">
Enable-PSRemoting 
</td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Remove-PSSession 
</td>
                <td>
                  <table id="pRemove-PSSession" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="param changed">
Session 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="changed cmdlet">
Enter-PSSession 
</td>
                <td>
                  <table id="pEnter-PSSession" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
NoCompression 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="changed param">
Session 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="changed param">
SessionOption 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
New-PSSession 
</td>
                <td>
                  <table id="pNew-PSSession" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
NoCompression 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="changed param">
Session 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="changed param">
SessionOption 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="changed cmdlet">
Export-PSSession 
</td>
                <td>
                  <table id="pExport-PSSession" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
OutputModule 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
Module 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
ModuleName 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
PSSnapin 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="changed param">
Session 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Import-PSSession 
</td>
                <td>
                  <table id="pImport-PSSession" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
Module 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
PSSnapin 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="changed param">
Session 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="added cmdlet">
New-PSSessionOption 
</td>
              </tr>
              <tr style="background-color: white">
                <td class="changed cmdlet">
Get-WSManInstance 
</td>
                <td>
                  <table id="pGet-WSManInstance" class="hidden" width="100%">
                    <tbody>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
Associations 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="added param">
CertificateThumbprint 
</td>
                      </tr>
                      <tr>
                        <td class="style1">
  
</td>
                        <td class="removed param">
References 
</td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
              <tr style="background-color: #f0f0f0">
                <td class="changed cmdlet">
Set-PSSessionConfiguration</td>
                <td class="added param">
ShowSecurityDescriptorUI</td>
              </tr>
            </tbody>
          </table>
        </p>
        <h4>Alias Changes
</h4>
        <p>
Some tweaking of aliases here. Personally I find alias changes in general to get under
my skin. Aliases are the first thing I learn and the first thing to trip me up when
things change. Regardless, the changes appear to make sense and are perhaps a bit
more mnemonic than before. 
</p>
        <p>
          <strong>Removed</strong>
        </p>
        <p>
          <span class="removed">emm</span> (Export-ModuleMember), <span class="removed">which</span> (Get-Command)
and <span class="removed">grid</span> (Out-Gridview)
</p>
        <p>
          <strong>Added</strong>
        </p>
        <p>
          <span class="added">ise</span> (powershell_ise.exe), <span class="added">rmo</span> (Remove-Module)
and <span class="added">saps</span> (Start-Process)
</p>
        <p>
          <strong>Changed</strong>
        </p>
        <p>
          <span class="changed">imo –&gt; ipmo</span> (Import-Module)
</p>
        <h4>Language Enhancements
</h4>
        <p>
The major change that has come to light so far is that statements are now allowed
on the right hand of an expression without having to use subexpressions. This is a
great fix, and one that will reduce the margin for error (and confusion) by a large
amount. Previously in CTP3, in order to use a statement like “if”, you had to use
the following syntax:
</p>
        <p>
        </p>
        <pre class="brush: posh">$result = $( if ($true) { 42 } )</pre>
        <p>
        </p>
        <p>
Now, you can drop the $( and ):
</p>
        <p>
        </p>
        <pre class="brush: posh">$result = if ($true) { 42 }</pre>
        <p>
        </p>
        <p>
or
</p>
        <p>
        </p>
        <pre class="brush: posh">$sequence = foreach ($i in 0..15) { [math]::pow(2, $i) }</pre>
        <p>
        </p>
        <p>
This is truly great stuff. 
</p>
        <h4>Jobs/Remoting
</h4>
        <p>
The best news here is the abundant help now available at your fingertips. Lots of
examples and meaty information concerning PSSessions and PSSessionConfigurations.
</p>
        <p>
          <strong>Local Jobs</strong>
        </p>
        <p>
Local jobs created now with Start-Job { ... } use an IPC channel to talk to the local
WinRM service to create jobs instead of using the more heavyweight HTTP channel. Yes,
you can infer from this that local jobs are still out of process; they run in their
own isolated runspace and have no access to the interactive session. What this means
in simpler terms is that local jobs are a lot faster now to get started. The biggest
win for local jobs is that <strong>they no longer require an elevated shell!</strong> you
can submit local jobs as a regular user now – just not remote ones (unless the applicable
remote PSSessionConfiguration is set to allow this - by default the ACL is admins
only).
</p>
        <p>
          <strong>Remoting</strong>
        </p>
        <p>
A welcome addition to this build is a new, dedicated <strong>Enable-PSRemoting</strong> Cmdlet:
</p>
        <p>
        </p>
        <div style="padding-bottom: 5px; background-color: #eeeeee; margin: 20px; padding-left: 5px; padding-right: 5px; padding-top: 5px">The
Enable-PSRemoting cmdlet configures the computer to receive Windows PowerShell remote
commands that are sent by using the WS-Management technology. 
<p></p><p>
You need to run this command only once on each computer that will receive commands.
You do not need to run it on computers that only send commands. Because the configuration
activates listeners, it is prudent to run it only where it is needed.
</p><p>
The Enable-PSRemoting cmdlet performs the following operations: 
</p><ul><li>
Runs the Set-WSManQuickConfig cmdlet, which performs the following tasks: 
<ul><li>
Starts the WinRM service. 
</li><li>
Sets the startup type on the WinRM service to Automatic. 
</li><li>
Creates a listener to accept requests on any IP address. 
</li><li>
Enables a firewall exception for WS-Management communications. 
</li></ul></li><li>
Enables all registered Windows PowerShell session configurations to receive instructions
from a remote computer. 
<ul><li>
Registers the "Microsoft.PowerShell" session configuration, if it is not already registered. 
</li><li>
Registers the "Microsoft.PowerShell32" session configuration on 64-bit computers,
if it is not already registered. 
</li><li>
Removes the "Deny Everyone" setting from the security descriptor for all the registered
session configurations. 
</li><li>
Restarts the WinRM service to make the preceding changes effective. 
</li></ul></li></ul></div>
        <p>
        </p>
        <p>
To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows,
you must start Windows PowerShell with the "Run as administrator" option. 
</p>
        <p>
          <strong>Session Configurations</strong>
        </p>
        <p>
There are a raft of Cmdlets dedicated to managing session configurations. So what
is a session configuration? To qoute the ever-present help system:
</p>
        <div style="padding-bottom: 5px; background-color: #eeeeee; margin: 20px; padding-left: 5px; padding-right: 5px; padding-top: 5px">
          <p>
A session configuration is a group of settings on the local computer that define the
environment for the Windows PowerShell sessions that are created when remote users
connect to the local computer.
</p>
          <p>
Administrators of the computer can use session configurations to protect the computer
and to define custom environments for users who connect to the computer.
</p>
          <p>
Administrators can also use session configurations to determine the permissions that
are required to connect to the computer remotely. By default, only members of the
Administrators group have permission to use the session configuration to connect remotely,
but you can change the default settings to allow all users, or selected users, to
connect remotely to your computer.
</p>
          <p>
Session configurations are a feature of Web Services for Management (WS-Management)
based Windows PowerShell remoting. They are used only when you use the New-PSSession,
Invoke-Command, or Enter-PSSession cmdlets to connect to a remote computer.
</p>
          <p>
            <strong>Note</strong>: To manage the session configurations on a computer that is
running Windows Vista, Windows Server 2008, or a later version of Windows, start Windows
PowerShell with the "Run as administrator" option.
</p>
        </div>
        <p>
          <a href="http://www.nivot.org/content/binary/WindowsLiveWriter/PowerSh.0DifferencesBetweenCTP3andWin7RC_D88A/image_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/PowerSh.0DifferencesBetweenCTP3andWin7RC_D88A/image_thumb.png" width="640" height="300" />
          </a>
        </p>
        <p>
That SecurityDescriptorSddl property looks like a lot of fun to modify, right? Don’t
worry, the <strong>ShowSecurityDescriptorUI</strong> comes to the rescue:
</p>
        <p>
          <a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0DifferencesBetweenCTP3Win7BetaandWi_8776/image_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0DifferencesBetweenCTP3Win7BetaandWi_8776/image_thumb.png" width="510" height="480" />
          </a>
        </p>
        <p>
        </p>
        <h3>Modules
</h3>
        <h5>Manifest Members
</h5>
        <p>
Modules have received some nice incremental improvements as well as some syntactic
changes. You should have noticed above that the manifest fields (exposed as parameters
on New-ModuleManifest)  have changed to reflect the two-stage process of how
a module’s members get exposed to the importer’s scope. A module passively <em>exports</em> members
with Export-ModuleMember, and the caller actively <em>imports</em> them with Import-Module;
hence “FunctionsToExport,” which subtly says that this can be imported.
</p>
        <p>
          <strong>Binary Modules</strong>
        </p>
        <p>
A binary module is now allowed to be the root module in a manifest by pointing the
ModuleToProcess key at the assembly, e.g. ModuleToProcess = “Pscx.dll.” This seems
more intuitive than before with the [seemingly] arbitrary restriction that they must
be secondary to a text based psm1.
</p>
        <h4>Built-In Modules
</h4>
        <p>
Shipping with Windows 7 for <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a> comes
two new Modules along with the others you should have noticed that arrived with CTP3
(BitsTransfer/FileTransfer and PSDiagnostics.)
</p>
        <p>
          <strong>AppLocker</strong>
        </p>
        <blockquote>
          <p>
AppLocker provides simple, powerful, rule-based structures for specifying which applications
can run that are centrally managed using Group Policy. It introduces "publisher rules"
that are based on an application's digital signature, making it possible to build
strong rules that account for application updates. For example, an organization can
create a rule to "allow all versions greater than 1.0 of Microsoft Dynamics CRM to
run if signed by Microsoft." With correctly structured rules, IT professionals can
safely deploy updates to allowed applications without having to build a new rule for
each version update.
</p>
        </blockquote>
        <p>
          <a href="http://technet.microsoft.com/en-us/windows/dd320283.aspx" target="_blank">About
AppLocker on TechNet</a>
        </p>
        <p>
          <strong>TroubleshootingPack</strong>
        </p>
        <blockquote>
          <p>
Windows Troubleshooting Platform (WTP) provides ISVs, OEMs, and administrators the
ability to write troubleshooting packs that discover and resolve software and hardware
issues, such as configuration issues, failed hardware, network issues, and application
compatibility issues. In WTP, an issue is referred to as a <em>root cause</em>. Previously,
troubleshooting software and hardware issues was a manual process; however, using
WTP you can automate the process of fixing the most common issues that the user might
encounter. 
</p>
        </blockquote>
        <p>
          <a href="http://msdn.microsoft.com/en-us/library/dd323706(VS.85).aspx" target="_blank">
            <strong>About
WTP on MSDN</strong>
          </a>
        </p>
        <h4>PowerShell Integrated Scripting Environment
</h4>
        <p>
The ISE has been vastly improved in terms of usability and sharpness in this build.
Difficult to isolate any one part of it that is much better; the whole experience
is just way smoother and intuitive. 
</p>
        <p>
          <a href="http://www.nivot.org/content/binary/WindowsLiveWriter/PowerSh.0DifferencesBetweenCTP3andWin7RC_D88A/image_4.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/PowerSh.0DifferencesBetweenCTP3andWin7RC_D88A/image_thumb_1.png" width="640" height="271" />
          </a>
        </p>
        <h5>ISE Object Model
</h5>
        <p>
The object model naming has changed quite a bit to be more intuitive and friendly
to beginners. Who needs to know about Runspaces? It’s a Tab, silly!
</p>
        <table border="1" cellspacing="0" cellpadding="2" width="671">
          <tbody>
            <tr>
              <th valign="top" width="361">
CTP3</th>
              <th valign="top" width="308">
RC</th>
            </tr>
            <tr>
              <td class="removed" valign="top" width="361">
$psise.CurrentOpenedRunspace</td>
              <td class="added" valign="top" width="308">
$psise.CurrentPowerShellTab</td>
            </tr>
            <tr>
              <td class="removed" valign="top" width="361">
$psise.CurrentOpenedRunspace.ToolsMenu</td>
              <td class="added" valign="top" width="308">
$psise.CurrentPowerShellTab.AddOnsMenu</td>
            </tr>
            <tr>
              <td class="removed" valign="top" width="361">
$psise.CurrentOpenedRunspace.OpenedFiles</td>
              <td class="added" valign="top" width="308">
$psise.CurrentPowerShellTab.Files</td>
            </tr>
            <tr>
              <td class="removed" valign="top" width="361">
$psise.CurrentOpenedRunspace.OpenedFiles.RemoveUnsaved($file)</td>
              <td class="added" valign="top" width="308">
$psise.CurrentPowerShellTab.Files.Remove($file,$true)</td>
            </tr>
            <tr>
              <td class="removed" valign="top" width="361">
$psise.OpenedRunspaces</td>
              <td class="added" valign="top" width="308">
$psise.PowerShellTabs</td>
            </tr>
            <tr>
              <td class="removed" valign="top" width="361">
$psise.OpenedRunspaces[1].Execute("string")</td>
              <td style="background-color: #ffeeee" valign="top" width="308">
                <span style="float: left" class="added">$psise.PowerShellTabs[1].Invoke({scriptBlock})</span>
                <span style="float: right; color: red">*</span>
              </td>
            </tr>
            <tr>
              <td class="removed" valign="top" width="361">
$psise.CurrentOpenedFile</td>
              <td class="added" valign="top" width="308">
$psise.CurrentFile</td>
            </tr>
            <tr>
              <td class="removed" valign="top" width="361">
$psise.Options.LocalHelp 
</td>
              <td class="added" valign="top" width="308">
$psise.Options.UseLocalHelp</td>
            </tr>
          </tbody>
        </table>
        <p>
          <font color="#ff0000">*</font>
          <strong>Note: </strong>You may only invoke script on
a tab <em>other</em> than the tab you’re using to execute this command (because you
can’t run two commands at the same time on the same tab!)
</p>
        <p>
The PowerShell team posted a way to make the RC build fairly compatible with CTP3
by adding new members to the $PSISE object which will proxy attempts to use the old
API to the new API. The post is called “<a href="http://blogs.msdn.com/powershell/archive/2009/05/27/update-typedata-ise-ctp3-vs-ise-rc-and-teched2009-demos.aspx" target="_blank">Update-TypeData,
ISE CTP3 vs ISE RC, and Teched2009 Demos</a>.” 
</p>
        <h5>Shortcut Changes
</h5>
        <p>
The shortcut to jump to the Script Pane is now Ctrl+I. (use Ctrl+D to jump to the
Command pane).
</p>
        <h4>Summary
</h4>
        <p>
The RC build is all about bugfixes and incremental improvements. I’m sure there’ll
be more fixes and additions as we near RTW/RTM and I’ll be here to post as much info
about them as possible. This is still just a drop in the ocean of what PowerShell
2.0 can do, and I’ll post more technical demos of features over the next little while.
</p>
        <p>
          <strong>Tips</strong>: run “Get-Help about_*” to get a list of all the overview topics
for the various features in PowerShell v2.
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=f789804c-5a35-4d5c-a303-d1a2bdc6bbc0" />
      </body>
      <title>PowerShell v2.0 – Differences Between CTP3/Win7Beta and Win7RC</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,f789804c-5a35-4d5c-a303-d1a2bdc6bbc0.aspx</guid>
      <link>http://www.nivot.org/2009/05/22/PowerShellV20DifferencesBetweenCTP3Win7BetaAndWin7RC.aspx</link>
      <pubDate>Fri, 22 May 2009 21:25:49 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;&lt;strong&gt;update #1 2009/5/23&lt;/strong&gt;: noted that local jobs (start-job) no longer
require an elevated shell.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;&lt;strong&gt;update #2 2009/5/28:&lt;/strong&gt; ISE object model and shortcut changes; update
for set-psessionconfiguration cmdlet (new screenshot); module changes (highlighted
new manifest member names, binary module can now be root module); &lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
I’ve been meaning to write this for a while, but it’s been a busy time. This is a
comparison of the significant differences between the standalone CTP3 or Windows 7
Beta version and the version that comes with Win7 RC (6.1.7100.0). For all intents
and purposes, the CTP3 version (6.1.6469.0) is &lt;em&gt;exactly&lt;/em&gt; the same as the Windows
7 Beta (6.1.7000.0) version.
&lt;/p&gt;
&lt;p&gt;
This is not going to be an exhaustive list of differences, but I will continue to
update this post as I find more things worth documenting. It should be safe to bookmark
the permalink. One of the nicest things about this release is that it appears that,
without exception, &lt;strong&gt;all built-in Cmdlets have help.&lt;/strong&gt; A lot of things
have been cleaned up and fixed in this build, from formatting of text to typos and
minor bugs/glitches. 
&lt;/p&gt;
&lt;h4&gt;Cmdlet Differences
&lt;/h4&gt;
&lt;p&gt;
This is a table listing Cmdlets that have either &lt;span class="changed"&gt;changed&lt;/span&gt; (navy),
been &lt;span class="added"&gt;added&lt;/span&gt; (green, underlined) or &lt;span class="removed"&gt;removed&lt;/span&gt; (red,
strike-through.) Changed Cmdlets have their parameters listed in the second column.
A changed parameter means that its Type has been changed; e.g. it accepts a different
.NET object than before. This is generally nothing to worry about since the corresponding
source of such objects is usually changed to match – typically another Cmdlet. Parameters&amp;nbsp;
and Cmdlets that have not changed, are not listed. 
&lt;/p&gt;
&lt;p&gt;
&lt;style type="text/css"&gt;&lt;!--
        #tbl td
        {
            vertical-align: top;
            font-size: 10pt;
        }
        .added
        {
            color: green;
            text-decoration: underline;
        }
        .removed
        {
            color: red;
            text-decoration: line-through;
        }
        .changed
        {
            color: navy;
        }
        .cmdlet
        {
            font-weight: bold;
            cursor: hand;
        }
        .param
        {
            font-style: italic;
            text-align: left;
        }
        .style1
        {
            width: 19px;
        }
    --&gt;&lt;/style&gt;
&lt;table id="tbl" border="1" width="600"&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
Cmdlet&lt;/th&gt;
&lt;th&gt;
Parameters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Invoke-Command 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pInvoke-Command" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="param removed"&gt;
NoCompression 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="param changed"&gt;
Session 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="param changed"&gt;
SessionOption 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="changed cmdlet"&gt;
Remove-Computer 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pRemove-Computer" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
Force 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
Reboot 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
ComputerName 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Add-Computer 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pAdd-Computer" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
ComputerName 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
Reboot 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="removed cmdlet"&gt;
Rename-Computer 
&lt;/td&gt;
&lt;td&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Test-Connection 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pTest-Connection" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
ComputerName 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
Quiet 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
Destination 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="changed cmdlet"&gt;
Export-FormatData 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pExport-FormatData" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp;&lt;/td&gt;
&lt;td class="added param"&gt;
Path 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
FilePath 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Receive-Job 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pReceive-Job" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="param changed"&gt;
Session 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="changed cmdlet"&gt;
Start-Job 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pStart-Job" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
InitializationScript 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
RunAs32 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
ConfigurationName 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
CertificateThumbprint 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
NoCompression 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Get-Module 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pGet-Module" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
Recurse 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="changed cmdlet"&gt;
New-ModuleManifest 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pNew-ModuleManifest" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
ProcessorArchitecture 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
DotNetFrameworkVersion 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
PowerShellHostName 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
PowerShellHostVersion 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
FileList 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
ModuleList 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
FunctionsToExport 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
AliasesToExport 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
VariablesToExport 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
CmdletsToExport 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
OtherFiles 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
ExportedFunctions 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
ExportedAliases 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
ExportedVariables 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
ExportedCmdlets 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="param changed"&gt;
RequiredModules 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Set-PSBreakpoint 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pSet-PSBreakpoint" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="param changed"&gt;
Script 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="added cmdlet"&gt;
Enable-PSRemoting 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Remove-PSSession 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pRemove-PSSession" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="param changed"&gt;
Session 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="changed cmdlet"&gt;
Enter-PSSession 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pEnter-PSSession" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
NoCompression 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="changed param"&gt;
Session 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="changed param"&gt;
SessionOption 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
New-PSSession 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pNew-PSSession" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
NoCompression 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="changed param"&gt;
Session 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="changed param"&gt;
SessionOption 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="changed cmdlet"&gt;
Export-PSSession 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pExport-PSSession" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
OutputModule 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
Module 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
ModuleName 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
PSSnapin 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="changed param"&gt;
Session 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Import-PSSession 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pImport-PSSession" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
Module 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
PSSnapin 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="changed param"&gt;
Session 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="added cmdlet"&gt;
New-PSSessionOption 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: white"&gt;
&lt;td class="changed cmdlet"&gt;
Get-WSManInstance 
&lt;/td&gt;
&lt;td&gt;
&lt;table id="pGet-WSManInstance" class="hidden" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
Associations 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="added param"&gt;
CertificateThumbprint 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="style1"&gt;
&amp;nbsp; 
&lt;/td&gt;
&lt;td class="removed param"&gt;
References 
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #f0f0f0"&gt;
&lt;td class="changed cmdlet"&gt;
Set-PSSessionConfiguration&lt;/td&gt;
&lt;td class="added param"&gt;
ShowSecurityDescriptorUI&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/p&gt;
&lt;h4&gt;Alias Changes
&lt;/h4&gt;
&lt;p&gt;
Some tweaking of aliases here. Personally I find alias changes in general to get under
my skin. Aliases are the first thing I learn and the first thing to trip me up when
things change. Regardless, the changes appear to make sense and are perhaps a bit
more mnemonic than before. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Removed&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class="removed"&gt;emm&lt;/span&gt; (Export-ModuleMember), &lt;span class="removed"&gt;which&lt;/span&gt; (Get-Command)
and &lt;span class="removed"&gt;grid&lt;/span&gt; (Out-Gridview)
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Added&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class="added"&gt;ise&lt;/span&gt; (powershell_ise.exe), &lt;span class="added"&gt;rmo&lt;/span&gt; (Remove-Module)
and &lt;span class="added"&gt;saps&lt;/span&gt; (Start-Process)
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Changed&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class="changed"&gt;imo –&amp;gt; ipmo&lt;/span&gt; (Import-Module)
&lt;/p&gt;
&lt;h4&gt;Language Enhancements
&lt;/h4&gt;
&lt;p&gt;
The major change that has come to light so far is that statements are now allowed
on the right hand of an expression without having to use subexpressions. This is a
great fix, and one that will reduce the margin for error (and confusion) by a large
amount. Previously in CTP3, in order to use a statement like “if”, you had to use
the following syntax:
&lt;/p&gt;
&lt;p&gt;
&lt;pre class="brush: posh"&gt;$result = $( if ($true) { 42 } )&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Now, you can drop the $( and ):
&lt;/p&gt;
&lt;p&gt;
&lt;pre class="brush: posh"&gt;$result = if ($true) { 42 }&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
or
&lt;/p&gt;
&lt;p&gt;
&lt;pre class="brush: posh"&gt;$sequence = foreach ($i in 0..15) { [math]::pow(2, $i) }&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
This is truly great stuff. 
&lt;/p&gt;
&lt;h4&gt;Jobs/Remoting
&lt;/h4&gt;
&lt;p&gt;
The best news here is the abundant help now available at your fingertips. Lots of
examples and meaty information concerning PSSessions and PSSessionConfigurations.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Local Jobs&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Local jobs created now with Start-Job { ... } use an IPC channel to talk to the local
WinRM service to create jobs instead of using the more heavyweight HTTP channel. Yes,
you can infer from this that local jobs are still out of process; they run in their
own isolated runspace and have no access to the interactive session. What this means
in simpler terms is that local jobs are a lot faster now to get started. The biggest
win for local jobs is that &lt;strong&gt;they no longer require an elevated shell!&lt;/strong&gt; you
can submit local jobs as a regular user now – just not remote ones (unless the applicable
remote PSSessionConfiguration is set to allow this - by default the ACL is admins
only).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Remoting&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
A welcome addition to this build is a new, dedicated &lt;strong&gt;Enable-PSRemoting&lt;/strong&gt; Cmdlet:
&lt;/p&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 5px; background-color: #eeeeee; margin: 20px; padding-left: 5px; padding-right: 5px; padding-top: 5px"&gt;The
Enable-PSRemoting cmdlet configures the computer to receive Windows PowerShell remote
commands that are sent by using the WS-Management technology. 
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
You need to run this command only once on each computer that will receive commands.
You do not need to run it on computers that only send commands. Because the configuration
activates listeners, it is prudent to run it only where it is needed.
&lt;/p&gt;
&lt;p&gt;
The Enable-PSRemoting cmdlet performs the following operations: 
&lt;ul&gt;
&lt;li&gt;
Runs the Set-WSManQuickConfig cmdlet, which performs the following tasks: 
&lt;ul&gt;
&lt;li&gt;
Starts the WinRM service. 
&lt;li&gt;
Sets the startup type on the WinRM service to Automatic. 
&lt;li&gt;
Creates a listener to accept requests on any IP address. 
&lt;li&gt;
Enables a firewall exception for WS-Management communications. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Enables all registered Windows PowerShell session configurations to receive instructions
from a remote computer. 
&lt;ul&gt;
&lt;li&gt;
Registers the "Microsoft.PowerShell" session configuration, if it is not already registered. 
&lt;li&gt;
Registers the "Microsoft.PowerShell32" session configuration on 64-bit computers,
if it is not already registered. 
&lt;li&gt;
Removes the "Deny Everyone" setting from the security descriptor for all the registered
session configurations. 
&lt;li&gt;
Restarts the WinRM service to make the preceding changes effective. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
To run this cmdlet on Windows Vista, Windows Server 2008, and later versions of Windows,
you must start Windows PowerShell with the "Run as administrator" option. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Session Configurations&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
There are a raft of Cmdlets dedicated to managing session configurations. So what
is a session configuration? To qoute the ever-present help system:
&lt;/p&gt;
&lt;div style="padding-bottom: 5px; background-color: #eeeeee; margin: 20px; padding-left: 5px; padding-right: 5px; padding-top: 5px"&gt;
&lt;p&gt;
A session configuration is a group of settings on the local computer that define the
environment for the Windows PowerShell sessions that are created when remote users
connect to the local computer.
&lt;/p&gt;
&lt;p&gt;
Administrators of the computer can use session configurations to protect the computer
and to define custom environments for users who connect to the computer.
&lt;/p&gt;
&lt;p&gt;
Administrators can also use session configurations to determine the permissions that
are required to connect to the computer remotely. By default, only members of the
Administrators group have permission to use the session configuration to connect remotely,
but you can change the default settings to allow all users, or selected users, to
connect remotely to your computer.
&lt;/p&gt;
&lt;p&gt;
Session configurations are a feature of Web Services for Management (WS-Management)
based Windows PowerShell remoting. They are used only when you use the New-PSSession,
Invoke-Command, or Enter-PSSession cmdlets to connect to a remote computer.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Note&lt;/strong&gt;: To manage the session configurations on a computer that is
running Windows Vista, Windows Server 2008, or a later version of Windows, start Windows
PowerShell with the "Run as administrator" option.
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;a href="http://www.nivot.org/content/binary/WindowsLiveWriter/PowerSh.0DifferencesBetweenCTP3andWin7RC_D88A/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/PowerSh.0DifferencesBetweenCTP3andWin7RC_D88A/image_thumb.png" width="640" height="300"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
That SecurityDescriptorSddl property looks like a lot of fun to modify, right? Don’t
worry, the &lt;strong&gt;ShowSecurityDescriptorUI&lt;/strong&gt; comes to the rescue:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0DifferencesBetweenCTP3Win7BetaandWi_8776/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0DifferencesBetweenCTP3Win7BetaandWi_8776/image_thumb.png" width="510" height="480"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;h3&gt;Modules
&lt;/h3&gt;
&lt;h5&gt;Manifest Members
&lt;/h5&gt;
&lt;p&gt;
Modules have received some nice incremental improvements as well as some syntactic
changes. You should have noticed above that the manifest fields (exposed as parameters
on New-ModuleManifest)&amp;nbsp; have changed to reflect the two-stage process of how
a module’s members get exposed to the importer’s scope. A module passively &lt;em&gt;exports&lt;/em&gt; members
with Export-ModuleMember, and the caller actively &lt;em&gt;imports&lt;/em&gt; them with Import-Module;
hence “FunctionsToExport,” which subtly says that this can be imported.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Binary Modules&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
A binary module is now allowed to be the root module in a manifest by pointing the
ModuleToProcess key at the assembly, e.g. ModuleToProcess = “Pscx.dll.” This seems
more intuitive than before with the [seemingly] arbitrary restriction that they must
be secondary to a text based psm1.
&lt;/p&gt;
&lt;h4&gt;Built-In Modules
&lt;/h4&gt;
&lt;p&gt;
Shipping with Windows 7 for &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;PowerShell&lt;/a&gt; comes
two new Modules along with the others you should have noticed that arrived with CTP3
(BitsTransfer/FileTransfer and PSDiagnostics.)
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;AppLocker&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
AppLocker provides simple, powerful, rule-based structures for specifying which applications
can run that are centrally managed using Group Policy. It introduces "publisher rules"
that are based on an application's digital signature, making it possible to build
strong rules that account for application updates. For example, an organization can
create a rule to "allow all versions greater than 1.0 of Microsoft Dynamics CRM to
run if signed by Microsoft." With correctly structured rules, IT professionals can
safely deploy updates to allowed applications without having to build a new rule for
each version update.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;a href="http://technet.microsoft.com/en-us/windows/dd320283.aspx" target="_blank"&gt;About
AppLocker on TechNet&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;TroubleshootingPack&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Windows Troubleshooting Platform (WTP) provides ISVs, OEMs, and administrators the
ability to write troubleshooting packs that discover and resolve software and hardware
issues, such as configuration issues, failed hardware, network issues, and application
compatibility issues. In WTP, an issue is referred to as a &lt;em&gt;root cause&lt;/em&gt;. Previously,
troubleshooting software and hardware issues was a manual process; however, using
WTP you can automate the process of fixing the most common issues that the user might
encounter. 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/dd323706(VS.85).aspx" target="_blank"&gt;&lt;strong&gt;About
WTP on MSDN&lt;/strong&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h4&gt;PowerShell Integrated Scripting Environment
&lt;/h4&gt;
&lt;p&gt;
The ISE has been vastly improved in terms of usability and sharpness in this build.
Difficult to isolate any one part of it that is much better; the whole experience
is just way smoother and intuitive. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.nivot.org/content/binary/WindowsLiveWriter/PowerSh.0DifferencesBetweenCTP3andWin7RC_D88A/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/PowerSh.0DifferencesBetweenCTP3andWin7RC_D88A/image_thumb_1.png" width="640" height="271"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;h5&gt;ISE Object Model
&lt;/h5&gt;
&lt;p&gt;
The object model naming has changed quite a bit to be more intuitive and friendly
to beginners. Who needs to know about Runspaces? It’s a Tab, silly!
&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="2" width="671"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th valign="top" width="361"&gt;
CTP3&lt;/th&gt;
&lt;th valign="top" width="308"&gt;
RC&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="removed" valign="top" width="361"&gt;
$psise.CurrentOpenedRunspace&lt;/td&gt;
&lt;td class="added" valign="top" width="308"&gt;
$psise.CurrentPowerShellTab&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="removed" valign="top" width="361"&gt;
$psise.CurrentOpenedRunspace.ToolsMenu&lt;/td&gt;
&lt;td class="added" valign="top" width="308"&gt;
$psise.CurrentPowerShellTab.AddOnsMenu&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="removed" valign="top" width="361"&gt;
$psise.CurrentOpenedRunspace.OpenedFiles&lt;/td&gt;
&lt;td class="added" valign="top" width="308"&gt;
$psise.CurrentPowerShellTab.Files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="removed" valign="top" width="361"&gt;
$psise.CurrentOpenedRunspace.OpenedFiles.RemoveUnsaved($file)&lt;/td&gt;
&lt;td class="added" valign="top" width="308"&gt;
$psise.CurrentPowerShellTab.Files.Remove($file,$true)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="removed" valign="top" width="361"&gt;
$psise.OpenedRunspaces&lt;/td&gt;
&lt;td class="added" valign="top" width="308"&gt;
$psise.PowerShellTabs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="removed" valign="top" width="361"&gt;
$psise.OpenedRunspaces[1].Execute("string")&lt;/td&gt;
&lt;td style="background-color: #ffeeee" valign="top" width="308"&gt;
&lt;span style="float: left" class="added"&gt;$psise.PowerShellTabs[1].Invoke({scriptBlock})&lt;/span&gt;&lt;span style="float: right; color: red"&gt;*&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="removed" valign="top" width="361"&gt;
$psise.CurrentOpenedFile&lt;/td&gt;
&lt;td class="added" valign="top" width="308"&gt;
$psise.CurrentFile&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="removed" valign="top" width="361"&gt;
$psise.Options.LocalHelp 
&lt;/td&gt;
&lt;td class="added" valign="top" width="308"&gt;
$psise.Options.UseLocalHelp&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
&lt;font color="#ff0000"&gt;*&lt;/font&gt; &lt;strong&gt;Note: &lt;/strong&gt;You may only invoke script on
a tab &lt;em&gt;other&lt;/em&gt; than the tab you’re using to execute this command (because you
can’t run two commands at the same time on the same tab!)
&lt;/p&gt;
&lt;p&gt;
The PowerShell team posted a way to make the RC build fairly compatible with CTP3
by adding new members to the $PSISE object which will proxy attempts to use the old
API to the new API. The post is called “&lt;a href="http://blogs.msdn.com/powershell/archive/2009/05/27/update-typedata-ise-ctp3-vs-ise-rc-and-teched2009-demos.aspx" target="_blank"&gt;Update-TypeData,
ISE CTP3 vs ISE RC, and Teched2009 Demos&lt;/a&gt;.” 
&lt;h5&gt;Shortcut Changes
&lt;/h5&gt;
&lt;p&gt;
The shortcut to jump to the Script Pane is now Ctrl+I. (use Ctrl+D to jump to the
Command pane).
&lt;/p&gt;
&lt;h4&gt;Summary
&lt;/h4&gt;
&lt;p&gt;
The RC build is all about bugfixes and incremental improvements. I’m sure there’ll
be more fixes and additions as we near RTW/RTM and I’ll be here to post as much info
about them as possible. This is still just a drop in the ocean of what PowerShell
2.0 can do, and I’ll post more technical demos of features over the next little while.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Tips&lt;/strong&gt;: run “Get-Help about_*” to get a list of all the overview topics
for the various features in PowerShell v2.
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=f789804c-5a35-4d5c-a303-d1a2bdc6bbc0" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,f789804c-5a35-4d5c-a303-d1a2bdc6bbc0.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>CTP3</category>
      <category>Microsoft</category>
      <category>Modules</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>RC</category>
      <category>Windows 7</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=1cffb994-49df-4dfc-80ca-813a604d1408</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,1cffb994-49df-4dfc-80ca-813a604d1408.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,1cffb994-49df-4dfc-80ca-813a604d1408.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=1cffb994-49df-4dfc-80ca-813a604d1408</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hey, so we did the unthinkable. We released another version of the PowerShell Community
Extensions. We’re calling it a beta, because we’ve be so swamped with Real Life stuff
that we’re not 100% confident that it is defect-free. It’s not going to murder your
servers or anything, but there might be some documentation missing and other minor
stuff. We’d really appreciate it if you can give it a test-drive. If you’re running
PowerShell v1.0 or v2.0 CTP3, please use the MSI installer. It will upgrade your Pscx
1.1.1 install if you have one. If, on the other hand, you are running Windows 7 RC
and/or have a later version of PowerShell than v2 CTP3, you can download the zipped
module and unzip to your user profile module directory at ~\documents\windowspowershell\modules\
and load it using “import-module pscx.”
</p>
        <p>
Thanks for your infinite patience (yes, it’s been a while and we’re sorry) and please
leave comments and issues on the tracker at <a href="http://pscx.codeplex.com/">http://pscx.codeplex.com/</a></p>
        <p>
          <a href="http://pscx.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=1615" target="_blank">View
the 1.2 Beta release page</a>.
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=1cffb994-49df-4dfc-80ca-813a604d1408" />
      </body>
      <title>Pscx 1.2 Beta Released</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,1cffb994-49df-4dfc-80ca-813a604d1408.aspx</guid>
      <link>http://www.nivot.org/2009/05/15/Pscx12BetaReleased.aspx</link>
      <pubDate>Fri, 15 May 2009 00:28:13 GMT</pubDate>
      <description>&lt;p&gt;
Hey, so we did the unthinkable. We released another version of the PowerShell Community
Extensions. We’re calling it a beta, because we’ve be so swamped with Real Life stuff
that we’re not 100% confident that it is defect-free. It’s not going to murder your
servers or anything, but there might be some documentation missing and other minor
stuff. We’d really appreciate it if you can give it a test-drive. If you’re running
PowerShell v1.0 or v2.0 CTP3, please use the MSI installer. It will upgrade your Pscx
1.1.1 install if you have one. If, on the other hand, you are running Windows 7 RC
and/or have a later version of PowerShell than v2 CTP3, you can download the zipped
module and unzip to your user profile module directory at ~\documents\windowspowershell\modules\
and load it using “import-module pscx.”
&lt;/p&gt;
&lt;p&gt;
Thanks for your infinite patience (yes, it’s been a while and we’re sorry) and please
leave comments and issues on the tracker at &lt;a href="http://pscx.codeplex.com/"&gt;http://pscx.codeplex.com/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://pscx.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=1615" target="_blank"&gt;View
the 1.2 Beta release page&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=1cffb994-49df-4dfc-80ca-813a604d1408" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,1cffb994-49df-4dfc-80ca-813a604d1408.aspx</comments>
      <category>Cmdlets</category>
      <category>CTP3</category>
      <category>Modules</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>PSCX</category>
      <category>SnapIns</category>
      <category>Windows 7</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=ae63739d-54e0-47df-b8f9-19ceb1890f95</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,ae63739d-54e0-47df-b8f9-19ceb1890f95.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,ae63739d-54e0-47df-b8f9-19ceb1890f95.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=ae63739d-54e0-47df-b8f9-19ceb1890f95</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There’s a bit of a flap going on now around the blogosphere as various vendors, eager
to get onto the PowerShell train, are doing the bare minimum to get their product
“powershellized.” No one has spent any time reading – or if they did, they weren’t
successful in trying to understand it – the <a href="http://www.microsoft.com/technet/scriptcenter/topics/winpsh/cmdline_std.mspx" target="_blank">Microsoft
Command Line Standard</a>. 
</p>
        <h4>Modules as Namespaces
</h4>
        <p>
That’s right, modules are not as crazy sounding as they seem. They can be used quite
simply to just group a load of functions together while allowing easy disambiguation
should there be a name collision with another function or cmdlet. It wasn’t always
this easy. 
</p>
        <h5>Namespaces in PowerShell v1.0
</h5>
        <p>
In PowerShell v1.0 it was possible to load two snap-ins that contained identically
named commands. This causes PowerShell to spit out an error about ambiguous commands
should you try to invoke one. The answer to this was to get the containing snap-in
name, and prefix it to the cmdlet name using a backslash as a separator:
</p>
        <pre class="brush: posh">$o = Pscx\New-Object Collections.Generic.Dictionary –Of String, Int
</pre>
        <p>
As you can see, this lets us call the hypothetical PowerShell Community Extensions
version of New-Object to create a generic type. If you want to call the original one,
you would have to prefix it like this:
</p>
        <pre class="brush: posh">$o = Microsoft.PowerShell.Utility\New-Object Int[] 5
</pre>
        <p>
Blech - that’s a bit of a lengthy sentence, but the solution to this is to use an
alias. Aliases are found before Cmdlets in the search path:
</p>
        <pre class="brush: posh">New-Alias New-Object Microsoft.PowerShell.Utility\New-Object
$o = New-Object Int[] 5 
</pre>
        <p>
The reason we need an alias here is because if you just typed the cmdlet without the
snap-in prefix, PowerShell v1.0 complains that it doesn’t know which one you want.
We forgot to add the mind reader snap-in!
</p>
        <p>
How about functions in PowerShell v1.0? If you dot source a ps1 file that contains
functions that already exist in the caller’s session, how do you disambiguate them?
Oops! You can’t. They are overwritten. Ouch. 
</p>
        <p>
You cannot use the namespace\ prefix for functions in v1 - the support is just not
there. However…
</p>
        <h5>Namespaces in PowerShell v2.0
</h5>
        <p>
Things are a lot better in this version. Let’s say you have two groups of functions
that you use in your business. One for your SharePoint farms, and another set for
your Citrix farms. Let’s ignore the perfectly acceptable idea of prefixing the noun
to differentiate for the moment and just imagine we have two ps1 files, containing
ideally named function with approved verb, simple noun:
</p>
        <pre class="brush: posh"># sharepoint functions
function Get-Server {
   # ... gets sharepoint server
}
function Get-Farm {
   # ... gets sharepoint farm
}
</pre>
        <p>
And the second script:
</p>
        <pre class="brush: posh"># citrix functions
function Get-Server {
    # ... gets citrix server
}
function Get-Farm {
    # ... gets citrix farm
}
</pre>
        <p>
If you tried to load these up with via a dot source, one after the other, the functions
from the second ps1 would overwrite the first lot. So this is where the wonder world
of modules is entered. First step:
</p>
        <p>
After renaming both ps1 files to use the psm1 extension instead, you have created
modules of the simplest form. Ignoring the details of how this is deployed (there
are several ways – documented on Microsoft and on many blogs, including this one),
let's look at how it's loaded and used:
</p>
        <pre class="brush: posh">import-module citrix
# Now our functions are loaded. Invocation options:
# assuming no clash, invoke with simple names
get-farm bleh
# load sharepoint module (it also has get-farm)
import-module sharepoint
# ok, sharepoint functions are loaded too, so we have two get-farm commands
# and the last loaded wins, so citrix get-farm is inaccessible through simple syntax, but...
# let's refer specifically to the citrix module function
citrix\get-farm
# and for sharepoint:
sharepoint\get-farm
# and thirdly, if you don't want to use the module qualifier (or "namespace") then you ALSO have the
# choice of applying a prefix on import - this is the primary use case for quick interactive use:
import-module citrix -prefix ctx
# now you can call functions like:
get-ctxfarm
# or even citrix\get-ctxfarm if you so felt like it, but redundant.
# same for sharepoint
import-module sharepoint -prefix sp
get-spfarm
</pre>
        <p>
Make sense so far? Unfortunately, as mentioned earlier, in v1.0 the module qualifier
(or "namespace") works ONLY for binary commands imported in a Snap-In DLL. Let’s see
how that works with get-childitem, a command from one of the preloaded Snap-Ins in
PowerShell:
</p>
        <pre class="brush: posh">gcm get-childitem | select pssnapin
</pre>
        <p>
outputs:<br /><br />
PSSnapIn<br />
--------<br />
Microsoft.PowerShell.Management 
</p>
Ergo, we invoke it like: <pre class="brush: posh">Microsoft.PowerShell.Management\get-childitem
# ... outputs file listing ...
</pre><h4>Module Aliasing
</h4><p>
Some modules may have longer names that you would be comfortable to type all the time.
Thankfully, there is a trick you can do that takes advantage of the fact that modules
can be nested. Let’s say you have a module from a vendor that is called something
like “Vendor.Division.Product” and it has a cmdlet in it called Get-Thing that happens
to clash with another Get-Thing you have loaded. Normally to disambiguate, you have
to type:
</p><pre class="brush: posh">import-module vendor.division.product
Vendor.Division.Product\Get-Thing
</pre><p>
…which is a bit annoying. Instead, wrap the initial import-module statement in a dynamic
module where you supply an explicit name for it, and import that instead ;-)
</p><pre class="brush: posh">new-module –name product { import-module vendor.division.product } | import-module
# you can now invoke the command like this:
product\get-thing
</pre><p>
Any modules that are imported inside a module have their commands automatically exported
as if they are part of the root module (unless you control visibility with export-modulemember).
Cool, eh?
</p><p>
Have fun!
</p><img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=ae63739d-54e0-47df-b8f9-19ceb1890f95" /></body>
      <title>PowerShell 2.0 CTP3: Modules, in Practice.</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,ae63739d-54e0-47df-b8f9-19ceb1890f95.aspx</guid>
      <link>http://www.nivot.org/2009/03/19/PowerShell20CTP3ModulesInPractice.aspx</link>
      <pubDate>Thu, 19 Mar 2009 15:20:46 GMT</pubDate>
      <description>&lt;p&gt;
There’s a bit of a flap going on now around the blogosphere as various vendors, eager
to get onto the PowerShell train, are doing the bare minimum to get their product
“powershellized.” No one has spent any time reading – or if they did, they weren’t
successful in trying to understand it – the &lt;a href="http://www.microsoft.com/technet/scriptcenter/topics/winpsh/cmdline_std.mspx" target="_blank"&gt;Microsoft
Command Line Standard&lt;/a&gt;. 
&lt;/p&gt;
&lt;h4&gt;Modules as Namespaces
&lt;/h4&gt;
&lt;p&gt;
That’s right, modules are not as crazy sounding as they seem. They can be used quite
simply to just group a load of functions together while allowing easy disambiguation
should there be a name collision with another function or cmdlet. It wasn’t always
this easy. 
&lt;h5&gt;Namespaces in PowerShell v1.0
&lt;/h5&gt;
&lt;p&gt;
In PowerShell v1.0 it was possible to load two snap-ins that contained identically
named commands. This causes PowerShell to spit out an error about ambiguous commands
should you try to invoke one. The answer to this was to get the containing snap-in
name, and prefix it to the cmdlet name using a backslash as a separator:
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;$o = Pscx\New-Object Collections.Generic.Dictionary –Of String, Int
&lt;/pre&gt;
&lt;p&gt;
As you can see, this lets us call the hypothetical PowerShell Community Extensions
version of New-Object to create a generic type. If you want to call the original one,
you would have to prefix it like this:
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;$o = Microsoft.PowerShell.Utility\New-Object Int[] 5
&lt;/pre&gt;
&lt;p&gt;
Blech - that’s a bit of a lengthy sentence, but the solution to this is to use an
alias. Aliases are found before Cmdlets in the search path:
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;New-Alias New-Object Microsoft.PowerShell.Utility\New-Object
$o = New-Object Int[] 5 
&lt;/pre&gt;
&lt;p&gt;
The reason we need an alias here is because if you just typed the cmdlet without the
snap-in prefix, PowerShell v1.0 complains that it doesn’t know which one you want.
We forgot to add the mind reader snap-in!
&lt;/p&gt;
&lt;p&gt;
How about functions in PowerShell v1.0? If you dot source a ps1 file that contains
functions that already exist in the caller’s session, how do you disambiguate them?
Oops! You can’t. They are overwritten. Ouch. 
&lt;/p&gt;
&lt;p&gt;
You cannot use the namespace\ prefix for functions in v1 - the support is just not
there. However…
&lt;/p&gt;
&lt;h5&gt;Namespaces in PowerShell v2.0
&lt;/h5&gt;
&lt;p&gt;
Things are a lot better in this version. Let’s say you have two groups of functions
that you use in your business. One for your SharePoint farms, and another set for
your Citrix farms. Let’s ignore the perfectly acceptable idea of prefixing the noun
to differentiate for the moment and just imagine we have two ps1 files, containing
ideally named function with approved verb, simple noun:
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;# sharepoint functions
function Get-Server {
   # ... gets sharepoint server
}
function Get-Farm {
   # ... gets sharepoint farm
}
&lt;/pre&gt;
&lt;p&gt;
And the second script:
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;# citrix functions
function Get-Server {
    # ... gets citrix server
}
function Get-Farm {
    # ... gets citrix farm
}
&lt;/pre&gt;
&lt;p&gt;
If you tried to load these up with via a dot source, one after the other, the functions
from the second ps1 would overwrite the first lot. So this is where the wonder world
of modules is entered. First step:
&lt;/p&gt;
&lt;p&gt;
After renaming both ps1 files to use the psm1 extension instead, you have created
modules of the simplest form. Ignoring the details of how this is deployed (there
are several ways – documented on Microsoft and on many blogs, including this one),
let's look at how it's loaded and used:
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;import-module citrix
# Now our functions are loaded. Invocation options:
# assuming no clash, invoke with simple names
get-farm bleh
# load sharepoint module (it also has get-farm)
import-module sharepoint
# ok, sharepoint functions are loaded too, so we have two get-farm commands
# and the last loaded wins, so citrix get-farm is inaccessible through simple syntax, but...
# let's refer specifically to the citrix module function
citrix\get-farm
# and for sharepoint:
sharepoint\get-farm
# and thirdly, if you don't want to use the module qualifier (or "namespace") then you ALSO have the
# choice of applying a prefix on import - this is the primary use case for quick interactive use:
import-module citrix -prefix ctx
# now you can call functions like:
get-ctxfarm
# or even citrix\get-ctxfarm if you so felt like it, but redundant.
# same for sharepoint
import-module sharepoint -prefix sp
get-spfarm
&lt;/pre&gt;
&lt;p&gt;
Make sense so far? Unfortunately, as mentioned earlier, in v1.0 the module qualifier
(or "namespace") works ONLY for binary commands imported in a Snap-In DLL. Let’s see
how that works with get-childitem, a command from one of the preloaded Snap-Ins in
PowerShell:
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;gcm get-childitem | select pssnapin
&lt;/pre&gt;
&lt;p&gt;
outputs:&lt;br&gt;
&lt;br&gt;
PSSnapIn&lt;br&gt;
--------&lt;br&gt;
Microsoft.PowerShell.Management 
&lt;/p&gt;
Ergo, we invoke it like: &lt;pre class="brush: posh"&gt;Microsoft.PowerShell.Management\get-childitem
# ... outputs file listing ...
&lt;/pre&gt;
&lt;h4&gt;Module Aliasing
&lt;/h4&gt;
&lt;p&gt;
Some modules may have longer names that you would be comfortable to type all the time.
Thankfully, there is a trick you can do that takes advantage of the fact that modules
can be nested. Let’s say you have a module from a vendor that is called something
like “Vendor.Division.Product” and it has a cmdlet in it called Get-Thing that happens
to clash with another Get-Thing you have loaded. Normally to disambiguate, you have
to type:
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;import-module vendor.division.product
Vendor.Division.Product\Get-Thing
&lt;/pre&gt;
&lt;p&gt;
…which is a bit annoying. Instead, wrap the initial import-module statement in a dynamic
module where you supply an explicit name for it, and import that instead ;-)
&lt;/p&gt;
&lt;pre class="brush: posh"&gt;new-module –name product { import-module vendor.division.product } | import-module
# you can now invoke the command like this:
product\get-thing
&lt;/pre&gt;
&lt;p&gt;
Any modules that are imported inside a module have their commands automatically exported
as if they are part of the root module (unless you control visibility with export-modulemember).
Cool, eh?
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=ae63739d-54e0-47df-b8f9-19ceb1890f95" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,ae63739d-54e0-47df-b8f9-19ceb1890f95.aspx</comments>
      <category>Cmdlets</category>
      <category>CTP3</category>
      <category>Modules</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=c5db121f-cd3d-4a29-9516-737d8094005e</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,c5db121f-cd3d-4a29-9516-737d8094005e.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,c5db121f-cd3d-4a29-9516-737d8094005e.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=c5db121f-cd3d-4a29-9516-737d8094005e</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Some of you may have heard that CTP3 has support for transferring files from remote
servers using BITS (<a href="http://en.wikipedia.org/wiki/Background_Intelligent_Transfer_Service" target="_blank">Background
Intelligent Transfer Service</a>) and quite possibly had a little dig around for it.
It’s not easy to find as using “get-help BITS” will not return any help unless you’ve
already loaded the module. Not a great win for discoverability, but hey, sometimes
you just have to read the manual, expletive deleted. So, lets have a quick look at
how this works. 
</p>
        <p>
          <a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_thumb.png" width="527" height="365" />
          </a>
        </p>
        <p>
So, ok, we can see we’ve got a module for <strong>FileTransfer</strong> (BITS), but
where did this come from? Take a peek into $pshome\Modules to find out. This is the
location for system-wide (global) modules. It rests under $PSHome, which is the home
for PowerShell, in $env:systemroot\windowspowershell\v1.0. 
</p>
        <p style="padding-bottom: 5px; background-color: lightgray; margin: 20px; padding-left: 5px; padding-right: 5px; padding-top: 5px">
Yes, even PowerShell v2 lives there. This is one of those unfortunate things whereby
the team decided early on that they would support side-by-side versions of PowerShell,
implying that v2 might not be backwards compatible with v1. This is reflected also
in the choice of file extension: ps1. The extension ps2 would have been used for v2.
This was probably a poor show of faith in their own abilities to design such a great
version one product, because as it turns out, v1.0 was such an excellent release that
they were able to build on it for v2 without compromising, or breaking backwards compatibility
(apart from a couple of minor edge cases, mainly bugfixes). So, the end result is
that future versions of PowerShell will inherit the $pshome, pay a little inheritance
tax and hopefully avoid foreclosure :).
</p>
        <p>
The files in the FileTransfer module directory are laid out as follows: 
</p>
        <p>
          <a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_4.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_thumb_1.png" width="621" height="248" />
          </a>
        </p>
        <p>
          <em>(Hey look! another built-in module – <strong>PSDiagnostics</strong> - I’ll leave
that one for you guys to explore).</em>
        </p>
        <p>
So, there are four files there. A ps1xml Format file, which tells PowerShell how to
textually render the .NET objects returned by the Cmdlets. A psd1 <a href="http://www.nivot.org/2008/12/30/PowerShellCTP3AndModuleManifests.aspx" target="_blank">Module
Manifest</a> file, which tells PowerShell what files comprise the Module and a binary
DLL which in this case does NOT contain the Cmdlets, but instead is what’s called
an “Interop Assembly.”  (sometimes known as Primary Interop Assemblies or PIAs,
read about them here: <a title="Primary Interop Assemblies" href="http://msdn.microsoft.com/en-us/library/aax7sdch.aspx">Primary
Interop Assemblies</a> – there are subtle differences between IAs and PIAs, but not
enough to warrant discussion here). Essentially this DLL lets .NET, and by extension,
PowerShell, talk to the native COM APIs that wrap the BITS services on XP,Vista,Win7,Win
2003 and Win 2008. Lets take a peek into the Module Manifest:
</p>
        <!-- Stylesheet link -->
        <link rel="stylesheet" type="text/css" href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css" />
        <!-- Code -->
        <div id="hlDiv" class="dp-highlighter">
          <div class="bar">
          </div>
          <ol class="dp-rb">
            <li class="alt">
              <span>
                <span>@{   </span>
              </span>
            </li>
            <li>
              <span>GUID=</span>
              <span class="string">"{8FA5064B-8479-4c5c-86EA-0D311FE48875}"</span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>Author=</span>
              <span class="string">"Microsoft Corporation"</span>
              <span>  </span>
            </li>
            <li>
              <span>CompanyName=</span>
              <span class="string">"Microsoft Corporation"</span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>Copyright=</span>
              <span class="string">"c Microsoft Corporation. All rights reserved."</span>
              <span>  </span>
            </li>
            <li>
              <span>ModuleVersion=</span>
              <span class="string">"1.0.0.0"</span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>Description=</span>
              <span class="string">"Powershell File Transfer Module"</span>
              <span>  </span>
            </li>
            <li>
              <span>PowerShellVersion=</span>
              <span class="string">"2.0"</span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>CLRVersion=</span>
              <span class="string">"2.0"</span>
              <span>  </span>
            </li>
            <li>
              <span>
                <strong>NestedModules</strong>=</span>
              <span class="string">"Microsoft.BackgroundIntelligentTransfer.Management"</span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>FormatsToProcess=</span>
              <span class="string">"FileTransfer.Format.ps1xml"</span>
              <span>  </span>
            </li>
            <li>
              <span>
                <strong>RequiredAssemblies</strong>=</span>
              <span class="builtin">Join-Path</span>
              <span> </span>
              <span class="variable">$psScriptRoot</span>
              <span> </span>
              <span class="string">"Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll"</span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>}  </span>
            </li>
          </ol>
        </div>
        <p>
If it looks like I just dumped a Hashtable out, you’re right. That’s all a manifest
is: a Hashtable. Of course, the key names are important and in this case, lets take
a look at two in particular, <strong>NestedModules</strong> and <strong>RequiredAssemblies</strong>.
</p>
        <p>
The RequiredAssemblies key is responsible for actively loading .NET assemblies containing
standard .NET types. It does not extract Providers and Cmdlets and add them to the
runspace; this is what the other key, NestedModules, does. Like I said already, this
DLL is the interop assembly. So where is the NestedModules loading that other module
from? I don’t see any other DLLs in the directory, and I <em>know</em> there are no
Cmdlets in that interop assembly. Lets take a peek at one of the Cmdlets itself and
find out:
</p>
        <p>
          <a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_8.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_thumb_3.png" width="575" height="526" />
          </a>
        </p>
        <p>
        </p>
        <p>
Aha, it’s reading it from the GAC. When PowerShell was installed, it must have installed
this DLL there. This is the DLL that contains our Cmdlets. I know this is true because
I used one of the Cmdlets to tell me where it lives. “GCM” is the alias for Get-Command
which will get us metadata about any given command in PowerShell (including functions
– new to v2).
</p>
        <p>
So, lets use a one-liner to get the names of all the Cmdlets in this module, and the
synopsis summary for the help:
</p>
        <div id="hlDiv" class="dp-highlighter">
          <div class="bar">
          </div>
          <ol class="dp-rb">
            <li class="alt">
              <span>
                <span>gcm -module filetransfer | % { </span>
                <span class="variable">$_</span>
                <span> |
select name, @{Name=</span>
                <span class="string">"Help"</span>
                <span>;Expression={&amp; </span>
                <span class="variable">$_</span>
                <span> -?
| select -expand synopsis }}} | convertto-html –fragment  </span>
              </span>
            </li>
          </ol>
        </div>
        <p>
This yields the following:
</p>
        <table>
          <colgroup>
            <col />
            <col />
          </colgroup>
          <tbody>
            <tr>
              <th>
Name</th>
              <th>
Help</th>
            </tr>
            <tr>
              <td>
Add-FileTransfer</td>
              <td>
Adds one or more files to an existing Background Intelligent Transfer Service (BITS)
t ransfer job.</td>
            </tr>
            <tr>
              <td>
Clear-FileTransfer</td>
              <td>
Cancels a Background Intelligent Transfer Service (BITS) transfer job.</td>
            </tr>
            <tr>
              <td>
Complete-FileTransfer</td>
              <td>
Completes a Background Intelligent Transfer Service (BITS) transfer job.</td>
            </tr>
            <tr>
              <td>
Get-FileTransfer</td>
              <td>
Retrieves the associated BitsJob object for an existing Background Intelligent Transfe
r Service (BITS) transfer job.</td>
            </tr>
            <tr>
              <td>
New-FileTransfer</td>
              <td>
Creates a new Background Intelligent Transfer Service (BITS) transfer job.</td>
            </tr>
            <tr>
              <td>
Resume-FileTransfer</td>
              <td>
Resumes a Background Intelligent Transfer Service (BITS) transfer job.</td>
            </tr>
            <tr>
              <td>
Set-FileTransfer</td>
              <td>
Modifies the properties of an existing Business Intelligent Transfer Service (BITS)
tr ansfer job.</td>
            </tr>
            <tr>
              <td>
Suspend-FileTransfer</td>
              <td>
Suspends a Background Intelligent Transfer Service (BITS) transfer job.</td>
            </tr>
          </tbody>
        </table>
        <p>
I guess this covers it for the moment. Going into a full discussion about how BITS
actually works is worth another post in itself. Suffice it to say, there are plenty
of examples in the help itself. Just run:
</p>
        <p>
          <strong>get-help add-filetransfer –example | more</strong>
        </p>
        <p>
To see an example on how to use the Cmdlet (or any of the others). The team have done
a good job here.
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=c5db121f-cd3d-4a29-9516-737d8094005e" />
      </body>
      <title>Anatomy of a PowerShell Module: The FileTransfer (BITS) Module</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,c5db121f-cd3d-4a29-9516-737d8094005e.aspx</guid>
      <link>http://www.nivot.org/2009/02/10/AnatomyOfAPowerShellModuleTheFileTransferBITSModule.aspx</link>
      <pubDate>Tue, 10 Feb 2009 18:38:27 GMT</pubDate>
      <description>&lt;p&gt;
Some of you may have heard that CTP3 has support for transferring files from remote
servers using BITS (&lt;a href="http://en.wikipedia.org/wiki/Background_Intelligent_Transfer_Service" target="_blank"&gt;Background
Intelligent Transfer Service&lt;/a&gt;) and quite possibly had a little dig around for it.
It’s not easy to find as using “get-help BITS” will not return any help unless you’ve
already loaded the module. Not a great win for discoverability, but hey, sometimes
you just have to read the manual, expletive deleted. So, lets have a quick look at
how this works. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_thumb.png" width="527" height="365"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
So, ok, we can see we’ve got a module for &lt;strong&gt;FileTransfer&lt;/strong&gt; (BITS), but
where did this come from? Take a peek into $pshome\Modules to find out. This is the
location for system-wide (global) modules. It rests under $PSHome, which is the home
for PowerShell, in $env:systemroot\windowspowershell\v1.0. 
&lt;/p&gt;
&lt;p style="padding-bottom: 5px; background-color: lightgray; margin: 20px; padding-left: 5px; padding-right: 5px; padding-top: 5px"&gt;
Yes, even PowerShell v2 lives there. This is one of those unfortunate things whereby
the team decided early on that they would support side-by-side versions of PowerShell,
implying that v2 might not be backwards compatible with v1. This is reflected also
in the choice of file extension: ps1. The extension ps2 would have been used for v2.
This was probably a poor show of faith in their own abilities to design such a great
version one product, because as it turns out, v1.0 was such an excellent release that
they were able to build on it for v2 without compromising, or breaking backwards compatibility
(apart from a couple of minor edge cases, mainly bugfixes). So, the end result is
that future versions of PowerShell will inherit the $pshome, pay a little inheritance
tax and hopefully avoid foreclosure :).
&lt;/p&gt;
&lt;p&gt;
The files in the FileTransfer module directory are laid out as follows: 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_thumb_1.png" width="621" height="248"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;(Hey look! another built-in module – &lt;strong&gt;PSDiagnostics&lt;/strong&gt; - I’ll leave
that one for you guys to explore).&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
So, there are four files there. A ps1xml Format file, which tells PowerShell how to
textually render the .NET objects returned by the Cmdlets. A psd1 &lt;a href="http://www.nivot.org/2008/12/30/PowerShellCTP3AndModuleManifests.aspx" target="_blank"&gt;Module
Manifest&lt;/a&gt; file, which tells PowerShell what files comprise the Module and a binary
DLL which in this case does NOT contain the Cmdlets, but instead is what’s called
an “Interop Assembly.”&amp;nbsp; (sometimes known as Primary Interop Assemblies or PIAs,
read about them here: &lt;a title="Primary Interop Assemblies" href="http://msdn.microsoft.com/en-us/library/aax7sdch.aspx"&gt;Primary
Interop Assemblies&lt;/a&gt; – there are subtle differences between IAs and PIAs, but not
enough to warrant discussion here). Essentially this DLL lets .NET, and by extension,
PowerShell, talk to the native COM APIs that wrap the BITS services on XP,Vista,Win7,Win
2003 and Win 2008. Lets take a peek into the Module Manifest:
&lt;/p&gt;
&lt;!-- Stylesheet link --&gt;
&lt;link rel="stylesheet" type="text/css" href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css"&gt;
&lt;!-- Code --&gt;
&lt;div id="hlDiv" class="dp-highlighter"&gt;
&lt;div class="bar"&gt;
&lt;/div&gt;
&lt;ol class="dp-rb"&gt;
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span&gt;@{&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span&gt;GUID=&lt;/span&gt;&lt;span class="string"&gt;"{8FA5064B-8479-4c5c-86EA-0D311FE48875}"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;Author=&lt;/span&gt;&lt;span class="string"&gt;"Microsoft Corporation"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;CompanyName=&lt;/span&gt;&lt;span class="string"&gt;"Microsoft Corporation"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;Copyright=&lt;/span&gt;&lt;span class="string"&gt;"c Microsoft Corporation. All rights reserved."&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;ModuleVersion=&lt;/span&gt;&lt;span class="string"&gt;"1.0.0.0"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;Description=&lt;/span&gt;&lt;span class="string"&gt;"Powershell File Transfer Module"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;PowerShellVersion=&lt;/span&gt;&lt;span class="string"&gt;"2.0"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;CLRVersion=&lt;/span&gt;&lt;span class="string"&gt;"2.0"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;&lt;strong&gt;NestedModules&lt;/strong&gt;=&lt;/span&gt;&lt;span class="string"&gt;"Microsoft.BackgroundIntelligentTransfer.Management"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;FormatsToProcess=&lt;/span&gt;&lt;span class="string"&gt;"FileTransfer.Format.ps1xml"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;&lt;strong&gt;RequiredAssemblies&lt;/strong&gt;=&lt;/span&gt;&lt;span class="builtin"&gt;Join-Path&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="variable"&gt;$psScriptRoot&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="string"&gt;"Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;}&amp;nbsp; &lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
If it looks like I just dumped a Hashtable out, you’re right. That’s all a manifest
is: a Hashtable. Of course, the key names are important and in this case, lets take
a look at two in particular, &lt;strong&gt;NestedModules&lt;/strong&gt; and &lt;strong&gt;RequiredAssemblies&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
The RequiredAssemblies key is responsible for actively loading .NET assemblies containing
standard .NET types. It does not extract Providers and Cmdlets and add them to the
runspace; this is what the other key, NestedModules, does. Like I said already, this
DLL is the interop assembly. So where is the NestedModules loading that other module
from? I don’t see any other DLLs in the directory, and I &lt;em&gt;know&lt;/em&gt; there are no
Cmdlets in that interop assembly. Lets take a peek at one of the Cmdlets itself and
find out:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Pow.0CTP3andthebuiltinFileTransferModule_ACD3/image_thumb_3.png" width="575" height="526"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Aha, it’s reading it from the GAC. When PowerShell was installed, it must have installed
this DLL there. This is the DLL that contains our Cmdlets. I know this is true because
I used one of the Cmdlets to tell me where it lives. “GCM” is the alias for Get-Command
which will get us metadata about any given command in PowerShell (including functions
– new to v2).
&lt;/p&gt;
&lt;p&gt;
So, lets use a one-liner to get the names of all the Cmdlets in this module, and the
synopsis summary for the help:
&lt;/p&gt;
&lt;div id="hlDiv" class="dp-highlighter"&gt;
&lt;div class="bar"&gt;
&lt;/div&gt;
&lt;ol class="dp-rb"&gt;
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span&gt;gcm -module filetransfer | % { &lt;/span&gt;&lt;span class="variable"&gt;$_&lt;/span&gt;&lt;span&gt; |
select name, @{Name=&lt;/span&gt;&lt;span class="string"&gt;"Help"&lt;/span&gt;&lt;span&gt;;Expression={&amp;amp; &lt;/span&gt;&lt;span class="variable"&gt;$_&lt;/span&gt;&lt;span&gt; -?
| select -expand synopsis }}} | convertto-html –fragment&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
This yields the following:
&lt;/p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col&gt;
&lt;col&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;
Name&lt;/th&gt;
&lt;th&gt;
Help&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Add-FileTransfer&lt;/td&gt;
&lt;td&gt;
Adds one or more files to an existing Background Intelligent Transfer Service (BITS)
t ransfer job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Clear-FileTransfer&lt;/td&gt;
&lt;td&gt;
Cancels a Background Intelligent Transfer Service (BITS) transfer job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Complete-FileTransfer&lt;/td&gt;
&lt;td&gt;
Completes a Background Intelligent Transfer Service (BITS) transfer job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-FileTransfer&lt;/td&gt;
&lt;td&gt;
Retrieves the associated BitsJob object for an existing Background Intelligent Transfe
r Service (BITS) transfer job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-FileTransfer&lt;/td&gt;
&lt;td&gt;
Creates a new Background Intelligent Transfer Service (BITS) transfer job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Resume-FileTransfer&lt;/td&gt;
&lt;td&gt;
Resumes a Background Intelligent Transfer Service (BITS) transfer job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Set-FileTransfer&lt;/td&gt;
&lt;td&gt;
Modifies the properties of an existing Business Intelligent Transfer Service (BITS)
tr ansfer job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Suspend-FileTransfer&lt;/td&gt;
&lt;td&gt;
Suspends a Background Intelligent Transfer Service (BITS) transfer job.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
I guess this covers it for the moment. Going into a full discussion about how BITS
actually works is worth another post in itself. Suffice it to say, there are plenty
of examples in the help itself. Just run:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;get-help add-filetransfer –example | more&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
To see an example on how to use the Cmdlet (or any of the others). The team have done
a good job here.
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=c5db121f-cd3d-4a29-9516-737d8094005e" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,c5db121f-cd3d-4a29-9516-737d8094005e.aspx</comments>
      <category>.NET</category>
      <category>BITS</category>
      <category>Cmdlets</category>
      <category>CTP3</category>
      <category>Modules</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=f33b33fb-273a-4c45-9695-cdcc0c768aaf</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,f33b33fb-273a-4c45-9695-cdcc0c768aaf.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,f33b33fb-273a-4c45-9695-cdcc0c768aaf.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=f33b33fb-273a-4c45-9695-cdcc0c768aaf</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It’s been quite a few years -- November 14, 2006 to be exact -- since the final release
of <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a> 1.0.
Let’s see what the <a href="http://blogs.msdn.com/powershell" target="_blank">lazy
buggers</a> have been up to since then. Only kidding, they’re far from lazy; we’ve
gained an extra one hundred and six new cmdlets, moving from 131 to 237. We’ve also
gained another provider, WSManProvider which lets you explore and manipulate the WS-Man
configuration. Finally, the number of public Types (.NET classes usable by 3rd parties
to extend PowerShell) has increased from 447 to 749. So how do I know all this? Well,
some months ago I wrote a suite of build analysis Cmdlets for examining the assemblies
that comprise PowerShell. In its current form it’s of very little use to 3rd parties,
but I’ve had some requests to open it up and allow it to analyze any binary modules
and snap-ins, which is a good idea I think. Watch this space. Anyway, I’m going to
dump out some interest information on the differences between v1.0 and v2.0 CTP3,
along with the one-liners I’m using to generate the information. 
</p>
        <p>
          <em>
            <strong>update feb 5</strong>: added breaking changes</em>
        </p>
        <h4>
          <b>Breaking Changes to Windows PowerShell 1.0</b>
          <u>
          </u>
        </h4>
        <p>
          <u>
          </u>
        </p>
        <p>
The following changes in Windows PowerShell V2.0 CTP3 might prevent features designed
for Windows PowerShell 1.0 from working correctly.<u></u></p>
        <ul>
          <ul>
            <li>
              <div align="left">The value of the <b>PowerShellVersion</b> registry entry in HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine
has been changed to <b>2.0</b>.
</div>
            </li>
            <li>
              <div align="left">New cmdlets and variables have been added. These are listed below.
These new elements might conflict with variables and functions in profiles and scripts.
</div>
            </li>
            <li>
              <div align="left">
                <b>-</b>IEQ operator does a case insensitive comparison on characters.
</div>
            </li>
            <li>
              <div align="left">Get-Command gets functions along with cmdlets by default. 
</div>
            </li>
            <li>
              <div align="left">Any native command that generates a user interface blocks if it
is pipelined to the Out-Host cmdlet.
</div>
            </li>
            <li>
              <div align="left">Added new language keywords: <b>Begin</b>, <strong>Process, </strong>and<strong> End</strong>.
Any commands called <b>begin</b>, <b>process</b> or <b>end</b> are interpreted as
language keywords and might result in parsing errors. 
</div>
            </li>
            <li>
              <div align="left">Cmdlet name resolution has changed. In Windows PowerShell 1.0, a
runtime error was generated when two Windows PowerShell snap-ins exported cmdlets
with the same name. In Windows PowerShell V2, the last cmdlet loaded is the one that
is executed if the cmdlet name is not qualified by a snap-in name.
</div>
            </li>
            <li>
              <div align="left">Terminating errors that are thrown in a pipeline do not terminate
the pipeline. Instead, they are written to the host. 
</div>
            </li>
            <li>
              <div align="left">A function called with '-?' parameter gets the help topic for the
function, if one is included in the function. 
</div>
            </li>
          </ul>
        </ul>
        <p>
There are no changes to Cmdlets other than Get-Command’s –PSSnapin parameter is now
an alias to a –Module parameter. This reflects the move away from administrator-installed
snap-ins, and towards the friendlier Module system. For all intents and purposes,
you can treat v1 snapins as modules as load them as such with the Import-Module Cmdlet.
</p>
        <h4>New Cmdlets
</h4>
        <p>
Here are the new Cmdlets, sorted by noun and alongside the textual synopsis is one
is present in the CTP3 help, or the syntax if there is no help. The command I ran
to generate this was:
</p>
        <p>
          <!-- Stylesheet link -->
        </p>
        <link rel="stylesheet" type="text/css" href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css" />
        <!-- Code -->
        <div id="hlDiv" class="dp-highlighter">
          <div class="bar">
          </div>
          <ol class="dp-rb">
            <li class="alt">
              <span>
                <span>compare-psbuildinfo (import-psbuildinfo .\rtm-6-0-6000-16386.psbuild)
(import-psbuildinfo .\win7beta1-6-1-7000-0.psbuild) | ? {</span>
                <span class="variable">$_</span>
                <span>.diff
-eq </span>
                <span class="string">"Added"</span>
                <span>} | sort noun | % { </span>
                <span class="variable">$_</span>
                <span> |
add-member -name Synopsis -member noteproperty -value (&amp; </span>
                <span class="variable">$_</span>
                <span>.name
-?</span>
                <span class="variable">|select</span>
                <span> -expand synopsis) -passthru }
| select name,synopsis | convertto-html -fragment &gt; new-cmdlets.htm  </span>
              </span>
            </li>
          </ol>
        </div>
        <p>
        </p>
        <style type="text/css">
          <!--
#cmdlets tr td { vertical-align: top; border-top: 1px solid gray; text-align: left; }
-->
        </style>
        <table id="cmdlets">
          <colgroup>
            <col />
            <col />
          </colgroup>
          <tbody>
            <tr>
              <th>
Name</th>
              <th>
Synopsis</th>
            </tr>
            <tr>
              <td>
Invoke-Command</td>
              <td>
Runs commands on local and remote computers.</td>
            </tr>
            <tr>
              <td>
Add-Computer</td>
              <td>
Adds computers to a domain or workgroup.</td>
            </tr>
            <tr>
              <td>
Remove-Computer</td>
              <td>
Removes computers from workgroups or domains.</td>
            </tr>
            <tr>
              <td>
Rename-Computer</td>
              <td>
Renames a computer.</td>
            </tr>
            <tr>
              <td>
Restore-Computer</td>
              <td>
Starts a system restore on the local computer.</td>
            </tr>
            <tr>
              <td>
Checkpoint-Computer</td>
              <td>
Creates a system restore point on the local computer.</td>
            </tr>
            <tr>
              <td>
Restart-Computer</td>
              <td>
Restarts ("reboots") the operating system on local and remote computers.</td>
            </tr>
            <tr>
              <td>
Stop-Computer</td>
              <td>
Stops (shuts down) local and remote computers.</td>
            </tr>
            <tr>
              <td>
Reset-ComputerMachinePassword</td>
              <td>
Resets the machine account password for the computer.</td>
            </tr>
            <tr>
              <td>
Disable-ComputerRestore</td>
              <td>
Disables the System Restore feature on the specified file system drive.</td>
            </tr>
            <tr>
              <td>
Enable-ComputerRestore</td>
              <td>
Enables the System Restore feature on the specified file system drive.</td>
            </tr>
            <tr>
              <td>
Get-ComputerRestorePoint</td>
              <td>
Gets the restore points on the local computer.</td>
            </tr>
            <tr>
              <td>
Test-ComputerSecureChannel</td>
              <td>
Test-ComputerSecureChannel [-Repair] [-Server &lt;String&gt;] [-Verbose] [-Debug]
[-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] [-WhatIf] [-Confirm] 
</td>
            </tr>
            <tr>
              <td>
Test-Connection</td>
              <td>
Sends ICMP echo request packets ("pings") to one or more computers.</td>
            </tr>
            <tr>
              <td>
Export-Counter</td>
              <td>
The Export-Counter cmdlet takes PerformanceCounterSampleSet objects and exports them
as counter log files.</td>
            </tr>
            <tr>
              <td>
Import-Counter</td>
              <td>
Imports performance counter log files (.blg, .csv, .tsv) and creates the objects that
represent each counter sample in the log.</td>
            </tr>
            <tr>
              <td>
Get-Counter</td>
              <td>
Gets performance counter data from local and remote computers.</td>
            </tr>
            <tr>
              <td>
ConvertFrom-Csv</td>
              <td>
Converts object properties in CSV format into CSV versions of the original objects.</td>
            </tr>
            <tr>
              <td>
ConvertTo-Csv</td>
              <td>
Converts .NET objects into a series of comma-separated, variable-length (CSV) strings.</td>
            </tr>
            <tr>
              <td>
Register-EngineEvent</td>
              <td>
Register-EngineEvent [-SourceIdentifier] &lt;String&gt; [[-Action] &lt;ScriptBlock&gt;]
[-MessageData &lt;PSObject&gt;] [-SupportEvent] [-Forward] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Unregister-Event</td>
              <td>
Unregister-Event [-SourceIdentifier] &lt;String&gt; [-Force] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] [-WhatIf] [-Confirm] Unregister-Event [-SubscriptionId] &lt;Int32&gt;
[-Force] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] [-WhatIf] [-Confirm] 
</td>
            </tr>
            <tr>
              <td>
New-Event</td>
              <td>
New-Event [-SourceIdentifier] &lt;String&gt; [[-Sender] &lt;PSObject&gt;] [[-EventArguments]
&lt;PSObject[]&gt;] [[-MessageData] &lt;PSObject&gt;] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Remove-Event</td>
              <td>
Remove-Event [-SourceIdentifier] &lt;String&gt; [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] [-WhatIf] [-Confirm] Remove-Event [-EventIdentifier] &lt;Int32&gt;
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] [-WhatIf] [-Confirm] 
</td>
            </tr>
            <tr>
              <td>
Wait-Event</td>
              <td>
Wait-Event [[-SourceIdentifier] &lt;String&gt;] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Get-Event</td>
              <td>
Get-Event [[-SourceIdentifier] &lt;String&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Show-EventLog</td>
              <td>
Displays the event logs of the local or a remote computer in Event Viewer.</td>
            </tr>
            <tr>
              <td>
New-EventLog</td>
              <td>
Creates a new event log and a new event source on a local or remote computer.</td>
            </tr>
            <tr>
              <td>
Remove-EventLog</td>
              <td>
Deletes an event log or unregisters an event source.</td>
            </tr>
            <tr>
              <td>
Clear-EventLog</td>
              <td>
Deletes all entries from specified event logs on the local or remote computers.</td>
            </tr>
            <tr>
              <td>
Write-EventLog</td>
              <td>
Writes an event to an event log.</td>
            </tr>
            <tr>
              <td>
Limit-EventLog</td>
              <td>
Sets the event log properties that limit the size of the event log and the age of
its entries.</td>
            </tr>
            <tr>
              <td>
Get-EventSubscriber</td>
              <td>
Get-EventSubscriber [[-SourceIdentifier] &lt;String&gt;] [-Force] [-Verbose] [-Debug]
[-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Export-FormatData</td>
              <td>
Export-FormatData [-InputObject &lt;ExtendedTypeDefinition[]&gt;] [-FilePath &lt;String&gt;]
[-Force] [-NoClobber] [-IncludeScriptBlock] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Get-FormatData</td>
              <td>
Get-FormatData [[-TypeName] &lt;String[]&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Out-GridView</td>
              <td>
Sends output to an interactive table in a separate window.</td>
            </tr>
            <tr>
              <td>
Clear-History</td>
              <td>
Deletes entries from the command history.</td>
            </tr>
            <tr>
              <td>
Get-HotFix</td>
              <td>
Gets the QFE updates that have been applied to the local and remote computers.</td>
            </tr>
            <tr>
              <td>
Stop-Job</td>
              <td>
Stops a Windows PowerShell background job.</td>
            </tr>
            <tr>
              <td>
Wait-Job</td>
              <td>
Suppresses the command prompt until one or all of the Windows PowerShell background
jobs running in the session are complete.</td>
            </tr>
            <tr>
              <td>
Remove-Job</td>
              <td>
Deletes a Windows PowerShell background job.</td>
            </tr>
            <tr>
              <td>
Start-Job</td>
              <td>
Starts a Windows PowerShell background job.</td>
            </tr>
            <tr>
              <td>
Get-Job</td>
              <td>
Gets Windows PowerShell background jobs that are running in the current session.</td>
            </tr>
            <tr>
              <td>
Receive-Job</td>
              <td>
Gets the results of the Windows PowerShell background jobs in the current session.
You can use this cmdlet to retrieve the output and errors of background jobs.</td>
            </tr>
            <tr>
              <td>
Update-List</td>
              <td>
Adds and removes items from a property value that contains a collection of objects.</td>
            </tr>
            <tr>
              <td>
Import-LocalizedData</td>
              <td>
Imports language-specific data into scripts and functions based on the UI culture
that is selected for the operating system.</td>
            </tr>
            <tr>
              <td>
Send-MailMessage</td>
              <td>
Sends an e-mail message.</td>
            </tr>
            <tr>
              <td>
Get-Module</td>
              <td>
Get-Module [[-Name] &lt;String[]&gt;] [-All] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] Get-Module
[[-Name] &lt;String[]&gt;] [-ListAvailable] [-Recurse] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Remove-Module</td>
              <td>
Remove-Module [-Name] &lt;String[]&gt; [-Force] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] [-WhatIf] [-Confirm] Remove-Module [-ModuleInfo] &lt;PSModuleInfo[]&gt;
[-Force] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] [-WhatIf] [-Confirm] 
</td>
            </tr>
            <tr>
              <td>
New-Module</td>
              <td>
New-Module [-ScriptBlock] &lt;ScriptBlock&gt; [-Function &lt;String[]&gt;] [-Cmdlet
&lt;String[]&gt;] [-ReturnResult] [-AsCustomObject] [-ArgumentList &lt;Object[]&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] New-Module [-Name] &lt;String&gt; [-ScriptBlock] &lt;ScriptBlock&gt;
[-Function &lt;String[]&gt;] [-Cmdlet &lt;String[]&gt;] [-ReturnResult] [-AsCustomObject]
[-ArgumentList &lt;Object[]&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Import-Module</td>
              <td>
Import-Module [-Name] &lt;String[]&gt; [-Prefix &lt;String&gt;] [-Function &lt;String[]&gt;]
[-Cmdlet &lt;String[]&gt;] [-Variable &lt;String[]&gt;] [-Alias &lt;String[]&gt;]
[-Force] [-PassThru] [-AsCustomObject] [-Version &lt;Version&gt;] [-ArgumentList &lt;Object[]&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] Import-Module [-Assembly] &lt;Assembly[]&gt; [-Prefix &lt;String&gt;]
[-Function &lt;String[]&gt;] [-Cmdlet &lt;String[]&gt;] [-Variable &lt;String[]&gt;]
[-Alias &lt;String[]&gt;] [-Force] [-PassThru] [-AsCustomObject] [-Version &lt;Version&gt;]
[-ArgumentList &lt;Object[]&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] Import-Module
[-ModuleInfo] &lt;PSModuleInfo[]&gt; [-Prefix &lt;String&gt;] [-Function &lt;String[]&gt;]
[-Cmdlet &lt;String[]&gt;] [-Variable &lt;String[]&gt;] [-Alias &lt;String[]&gt;]
[-Force] [-PassThru] [-AsCustomObject] [-Version &lt;Version&gt;] [-ArgumentList &lt;Object[]&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Test-ModuleManifest</td>
              <td>
Test-ModuleManifest [-Path] &lt;String&gt; [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
New-ModuleManifest</td>
              <td>
New-ModuleManifest [-Path] &lt;String&gt; -NestedModules &lt;String[]&gt; [-Guid &lt;Guid&gt;]
-Author &lt;String&gt; -CompanyName &lt;String&gt; -Copyright &lt;String&gt; [-ModuleToProcess
&lt;String&gt;] [-ModuleVersion &lt;Version&gt;] -Description &lt;String&gt; [-PowerShellVersion
&lt;Version&gt;] [-ClrVersion &lt;Version&gt;] [-RequiredModules &lt;IDictionary[]&gt;]
-TypesToProcess &lt;String[]&gt; -FormatsToProcess &lt;String[]&gt; [-ScriptsToProcess
&lt;String[]&gt;] -RequiredAssemblies &lt;String[]&gt; -OtherFiles &lt;String[]&gt;
[-ExportedFunctions &lt;String[]&gt;] [-ExportedAliases &lt;String[]&gt;] [-ExportedVariables
&lt;String[]&gt;] [-ExportedCmdlets &lt;String[]&gt;] [-PrivateData &lt;Object&gt;]
[-PassThru] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] [-WhatIf] [-Confirm] 
</td>
            </tr>
            <tr>
              <td>
Export-ModuleMember</td>
              <td>
Export-ModuleMember [[-Function] &lt;String[]&gt;] [-Cmdlet &lt;String[]&gt;] [-Variable
&lt;String[]&gt;] [-Alias &lt;String[]&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Register-ObjectEvent</td>
              <td>
Register-ObjectEvent [-InputObject] &lt;PSObject&gt; [-EventName] &lt;String&gt; [[-SourceIdentifier]
&lt;String&gt;] [[-Action] &lt;ScriptBlock&gt;] [-MessageData &lt;PSObject&gt;] [-SupportEvent]
[-Forward] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Start-Process</td>
              <td>
Starts one or more processes on the local computer.</td>
            </tr>
            <tr>
              <td>
Debug-Process</td>
              <td>
Debugs one or more processes running on the local computer.</td>
            </tr>
            <tr>
              <td>
Wait-Process</td>
              <td>
Waits for the processes to be stopped before accepting more input.</td>
            </tr>
            <tr>
              <td>
Enable-PSBreakpoint</td>
              <td>
Enables the breakpoints in the current console.</td>
            </tr>
            <tr>
              <td>
Disable-PSBreakpoint</td>
              <td>
Disables the breakpoints in the current console.</td>
            </tr>
            <tr>
              <td>
Remove-PSBreakpoint</td>
              <td>
Deletes breakpoints from the current console.</td>
            </tr>
            <tr>
              <td>
Set-PSBreakpoint</td>
              <td>
Sets a breakpoint on a line, command, or variable.</td>
            </tr>
            <tr>
              <td>
Get-PSBreakpoint</td>
              <td>
Gets the breakpoints that are set in the current console.</td>
            </tr>
            <tr>
              <td>
Get-PSCallStack</td>
              <td>
Displays the current call stack.</td>
            </tr>
            <tr>
              <td>
Remove-PSSession</td>
              <td>
Closes one or more Windows PowerShell sessions (PSSessions).</td>
            </tr>
            <tr>
              <td>
Enter-PSSession</td>
              <td>
Starts an interactive session with a remote computer.</td>
            </tr>
            <tr>
              <td>
Exit-PSSession</td>
              <td>
Ends an interactive session with a remote computer.</td>
            </tr>
            <tr>
              <td>
Get-PSSession</td>
              <td>
Gets the Windows PowerShell sessions (PSSessions) in the current session.</td>
            </tr>
            <tr>
              <td>
Export-PSSession</td>
              <td>
Saves commands from another session in a script module file.</td>
            </tr>
            <tr>
              <td>
Import-PSSession</td>
              <td>
Imports cmdlets, aliases, functions, and other command types from another session
on a local or remote computer into the current session.</td>
            </tr>
            <tr>
              <td>
New-PSSession</td>
              <td>
Creates a persistent connection to a local or remote computer.</td>
            </tr>
            <tr>
              <td>
Set-PSSessionConfiguration</td>
              <td>
Set-PSSessionConfiguration [-Name] &lt;String&gt; [-ApplicationBase &lt;String&gt;]
[-ThreadApartmentState &lt;ApartmentState&gt;] [-ThreadOptions &lt;PSThreadOptions&gt;]
[-StartupScript &lt;String&gt;] [-MaximumReceivedDataSizePerCommandMB &lt;Nullable`1&gt;]
[-MaximumReceivedObjectSizeMB &lt;Nullable`1&gt;] [-SecurityDescriptorSddl &lt;String&gt;]
[-Force] [-NoServiceRestart] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] Set-PSSessionConfiguration
[-Name] &lt;String&gt; [-AssemblyName] &lt;String&gt; [-ConfigurationTypeName] &lt;String&gt;
[-ApplicationBase &lt;String&gt;] [-ThreadApartmentState &lt;ApartmentState&gt;] [-ThreadOptions
&lt;PSThreadOptions&gt;] [-StartupScript &lt;String&gt;] [-MaximumReceivedDataSizePerCommandMB
&lt;Nullable`1&gt;] [-MaximumReceivedObjectSizeMB &lt;Nullable`1&gt;] [-SecurityDescriptorSddl
&lt;String&gt;] [-Force] [-NoServiceRestart] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Enable-PSSessionConfiguration</td>
              <td>
Enable-PSSessionConfiguration [[-Name] &lt;String[]&gt;] [-Force] [-SecurityDescriptorSddl
&lt;String&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Disable-PSSessionConfiguration</td>
              <td>
Disable-PSSessionConfiguration [[-Name] &lt;String[]&gt;] [-Force] [-Verbose] [-Debug]
[-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Register-PSSessionConfiguration</td>
              <td>
Register-PSSessionConfiguration [-Name] &lt;String&gt; [-ProcessorArchitecture &lt;String&gt;]
[-ApplicationBase &lt;String&gt;] [-ThreadApartmentState &lt;ApartmentState&gt;] [-ThreadOptions
&lt;PSThreadOptions&gt;] [-StartupScript &lt;String&gt;] [-MaximumReceivedDataSizePerCommandMB
&lt;Nullable`1&gt;] [-MaximumReceivedObjectSizeMB &lt;Nullable`1&gt;] [-SecurityDescriptorSddl
&lt;String&gt;] [-Force] [-NoServiceRestart] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] Register-PSSessionConfiguration
[-Name] &lt;String&gt; [-AssemblyName] &lt;String&gt; [-ConfigurationTypeName] &lt;String&gt;
[-ProcessorArchitecture &lt;String&gt;] [-ApplicationBase &lt;String&gt;] [-ThreadApartmentState
&lt;ApartmentState&gt;] [-ThreadOptions &lt;PSThreadOptions&gt;] [-StartupScript &lt;String&gt;]
[-MaximumReceivedDataSizePerCommandMB &lt;Nullable`1&gt;] [-MaximumReceivedObjectSizeMB
&lt;Nullable`1&gt;] [-SecurityDescriptorSddl &lt;String&gt;] [-Force] [-NoServiceRestart]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Unregister-PSSessionConfiguration</td>
              <td>
Unregister-PSSessionConfiguration [-Name] &lt;String&gt; [-Force] [-NoServiceRestart]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Get-PSSessionConfiguration</td>
              <td>
Get-PSSessionConfiguration [[-Name] &lt;String[]&gt;] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Get-Random</td>
              <td>
Gets a random number or selects objects randomly from a collection.</td>
            </tr>
            <tr>
              <td>
Set-StrictMode</td>
              <td>
Establishes and enforces coding rules in expressions, scripts, and script blocks.</td>
            </tr>
            <tr>
              <td>
ConvertFrom-StringData</td>
              <td>
Converts a string containing one or more "name=value" pairs to a hash table.</td>
            </tr>
            <tr>
              <td>
Undo-Transaction</td>
              <td>
Rolls back the active transaction.</td>
            </tr>
            <tr>
              <td>
Use-Transaction</td>
              <td>
Adds the script block to the active transaction.</td>
            </tr>
            <tr>
              <td>
Complete-Transaction</td>
              <td>
Commits the active transaction.</td>
            </tr>
            <tr>
              <td>
Get-Transaction</td>
              <td>
Gets the current (active) transaction.</td>
            </tr>
            <tr>
              <td>
Start-Transaction</td>
              <td>
Starts a transaction.</td>
            </tr>
            <tr>
              <td>
Add-Type</td>
              <td>
Adds a .NET type (a class) to a Windows PowerShell session.</td>
            </tr>
            <tr>
              <td>
New-WebServiceProxy</td>
              <td>
Creates a Web service proxy object that lets you use and manage the Web service in
Windows PowerShell.</td>
            </tr>
            <tr>
              <td>
Get-WinEvent</td>
              <td>
Gets events from event logs and event tracing log files on local and remote computers.
This cmdlet runs only on Windows Vista and later versions of Windows.</td>
            </tr>
            <tr>
              <td>
Register-WmiEvent</td>
              <td>
Register-WmiEvent [-Class] &lt;String&gt; [[-SourceIdentifier] &lt;String&gt;] [[-Action]
&lt;ScriptBlock&gt;] [-Namespace &lt;String&gt;] [-Credential &lt;PSCredential&gt;]
[-ComputerName &lt;String&gt;] [-Timeout &lt;Int64&gt;] [-MessageData &lt;PSObject&gt;]
[-SupportEvent] [-Forward] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] Register-WmiEvent
[-Query] &lt;String&gt; [[-SourceIdentifier] &lt;String&gt;] [[-Action] &lt;ScriptBlock&gt;]
[-Namespace &lt;String&gt;] [-Credential &lt;PSCredential&gt;] [-ComputerName &lt;String&gt;]
[-Timeout &lt;Int64&gt;] [-MessageData &lt;PSObject&gt;] [-SupportEvent] [-Forward]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Set-WmiInstance</td>
              <td>
Creates or modifies instances of WMI classes.</td>
            </tr>
            <tr>
              <td>
Invoke-WmiMethod</td>
              <td>
Calls WMI methods.</td>
            </tr>
            <tr>
              <td>
Remove-WmiObject</td>
              <td>
Deletes WMI classes and instances.</td>
            </tr>
            <tr>
              <td>
Disconnect-WSMan</td>
              <td>
Disconnect-WSMan [[-ComputerName] &lt;String&gt;] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Connect-WSMan</td>
              <td>
Connect-WSMan [[-ComputerName] &lt;String&gt;] [-ApplicationName &lt;String&gt;] [-Authentication
&lt;AuthenticationMechanism&gt;] [-Credential &lt;PSCredential&gt;] [-OptionSet &lt;Hashtable&gt;]
[-Port &lt;Int32&gt;] [-SessionOption &lt;SessionOption&gt;] [-UseSSL] [-Verbose]
[-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] Connect-WSMan [-Authentication &lt;AuthenticationMechanism&gt;]
[-ConnectionURI &lt;Uri&gt;] [-Credential &lt;PSCredential&gt;] [-OptionSet &lt;Hashtable&gt;]
[-Port &lt;Int32&gt;] [-SessionOption &lt;SessionOption&gt;] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Test-WSMan</td>
              <td>
Test-WSMan [[-ComputerName] &lt;String&gt;] [-Authentication &lt;AuthenticationMechanism&gt;]
[-Credential &lt;PSCredential&gt;] [-Port &lt;Int32&gt;] [-UseSSL] [-ApplicationName
&lt;String&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Invoke-WSManAction</td>
              <td>
Invoke-WSManAction [-ResourceURI] &lt;Uri&gt; [-Action] &lt;String&gt; [[-SelectorSet]
&lt;Hashtable&gt;] [-Authentication &lt;AuthenticationMechanism&gt;] [-ConnectionURI
&lt;Uri&gt;] [-Credential &lt;PSCredential&gt;] [-FilePath &lt;String&gt;] [-OptionSet
&lt;Hashtable&gt;] [-SessionOption &lt;SessionOption&gt;] [-ValueSet &lt;Hashtable&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] Invoke-WSManAction [-ResourceURI] &lt;Uri&gt; [-Action]
&lt;String&gt; [[-SelectorSet] &lt;Hashtable&gt;] [-ApplicationName &lt;String&gt;]
[-Authentication &lt;AuthenticationMechanism&gt;] [-ComputerName &lt;String&gt;] [-Credential
&lt;PSCredential&gt;] [-FilePath &lt;String&gt;] [-OptionSet &lt;Hashtable&gt;] [-Port
&lt;Int32&gt;] [-SessionOption &lt;SessionOption&gt;] [-UseSSL] [-ValueSet &lt;Hashtable&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Get-WSManCredSSP</td>
              <td>
Get-WSManCredSSP [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Enable-WSManCredSSP</td>
              <td>
Enable-WSManCredSSP [-DelegateComputer] &lt;String[]&gt; [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Disable-WSManCredSSP</td>
              <td>
Disable-WSManCredSSP [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Remove-WSManInstance</td>
              <td>
Remove-WSManInstance [-ResourceURI] &lt;Uri&gt; [-SelectorSet] &lt;Hashtable&gt; [-ApplicationName
&lt;String&gt;] [-Authentication &lt;AuthenticationMechanism&gt;] [-ComputerName &lt;String&gt;]
[-Credential &lt;PSCredential&gt;] [-OptionSet &lt;Hashtable&gt;] [-Port &lt;Int32&gt;]
[-SessionOption &lt;SessionOption&gt;] [-UseSSL] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] Remove-WSManInstance [-ResourceURI] &lt;Uri&gt; [-SelectorSet] &lt;Hashtable&gt;
[-Authentication &lt;AuthenticationMechanism&gt;] [-ConnectionURI &lt;Uri&gt;] [-Credential
&lt;PSCredential&gt;] [-OptionSet &lt;Hashtable&gt;] [-SessionOption &lt;SessionOption&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
New-WSManInstance</td>
              <td>
New-WSManInstance [-ResourceURI] &lt;Uri&gt; [-SelectorSet] &lt;Hashtable&gt; [-ApplicationName
&lt;String&gt;] [-Authentication &lt;AuthenticationMechanism&gt;] [-ComputerName &lt;String&gt;]
[-Credential &lt;PSCredential&gt;] [-FilePath &lt;String&gt;] [-OptionSet &lt;Hashtable&gt;]
[-Port &lt;Int32&gt;] [-SessionOption &lt;SessionOption&gt;] [-UseSSL] [-ValueSet
&lt;Hashtable&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] New-WSManInstance [-ResourceURI]
&lt;Uri&gt; [-SelectorSet] &lt;Hashtable&gt; [-Authentication &lt;AuthenticationMechanism&gt;]
[-ConnectionURI &lt;Uri&gt;] [-Credential &lt;PSCredential&gt;] [-FilePath &lt;String&gt;]
[-OptionSet &lt;Hashtable&gt;] [-SessionOption &lt;SessionOption&gt;] [-ValueSet &lt;Hashtable&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Get-WSManInstance</td>
              <td>
Get-WSManInstance [-ResourceURI] &lt;Uri&gt; [-ApplicationName &lt;String&gt;] [-Authentication
&lt;AuthenticationMechanism&gt;] [-ComputerName &lt;String&gt;] [-ConnectionURI &lt;Uri&gt;]
[-Credential &lt;PSCredential&gt;] [-Dialect &lt;Uri&gt;] [-Fragment &lt;String&gt;]
[-OptionSet &lt;Hashtable&gt;] [-Port &lt;Int32&gt;] [-SelectorSet &lt;Hashtable&gt;]
[-SessionOption &lt;SessionOption&gt;] [-UseSSL] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] Get-WSManInstance [-ResourceURI] &lt;Uri&gt; [-ApplicationName &lt;String&gt;]
[-Authentication &lt;AuthenticationMechanism&gt;] [-BasePropertiesOnly] [-ComputerName
&lt;String&gt;] [-ConnectionURI &lt;Uri&gt;] [-Credential &lt;PSCredential&gt;] [-Dialect
&lt;Uri&gt;] -Enumerate [-Filter &lt;String&gt;] [-OptionSet &lt;Hashtable&gt;] [-Port
&lt;Int32&gt;] [-References] [-ReturnType &lt;String&gt;] [-SessionOption &lt;SessionOption&gt;]
[-Shallow] [-UseSSL] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction
&lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;]
[-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Set-WSManInstance</td>
              <td>
Set-WSManInstance [-ResourceURI] &lt;Uri&gt; [[-SelectorSet] &lt;Hashtable&gt;] [-ApplicationName
&lt;String&gt;] [-Authentication &lt;AuthenticationMechanism&gt;] [-ComputerName &lt;String&gt;]
[-Credential &lt;PSCredential&gt;] [-Dialect &lt;Uri&gt;] [-FilePath &lt;String&gt;]
[-Fragment &lt;String&gt;] [-OptionSet &lt;Hashtable&gt;] [-Port &lt;Int32&gt;] [-SessionOption
&lt;SessionOption&gt;] [-UseSSL] [-ValueSet &lt;Hashtable&gt;] [-Verbose] [-Debug]
[-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] Set-WSManInstance [-ResourceURI] &lt;Uri&gt; [[-SelectorSet]
&lt;Hashtable&gt;] [-Authentication &lt;AuthenticationMechanism&gt;] [-ConnectionURI
&lt;Uri&gt;] [-Credential &lt;PSCredential&gt;] [-Dialect &lt;Uri&gt;] [-FilePath
&lt;String&gt;] [-Fragment &lt;String&gt;] [-OptionSet &lt;Hashtable&gt;] [-SessionOption
&lt;SessionOption&gt;] [-ValueSet &lt;Hashtable&gt;] [-Verbose] [-Debug] [-ErrorAction
&lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable
&lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer
&lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Set-WSManQuickConfig</td>
              <td>
Set-WSManQuickConfig [-UseSSL] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
New-WSManSessionOption</td>
              <td>
New-WSManSessionOption [-ProxyAccessType &lt;ProxyAccessType&gt;] [-ProxyAuthentication
&lt;ProxyAuthentication&gt;] [-ProxyCredential &lt;PSCredential&gt;] [-SkipCACheck]
[-SkipCNCheck] [-SkipRevocationCheck] [-SPNPort &lt;Int32&gt;] [-OperationTimeout
&lt;Int32&gt;] [-NoEncryption] [-UseUTF16] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
Select-Xml</td>
              <td>
Select-Xml [-XPath] &lt;String&gt; [-Path] &lt;String[]&gt; [-Namespace &lt;Hashtable&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] Select-Xml [-XPath] &lt;String&gt; [-Xml] &lt;XmlNode[]&gt;
[-Namespace &lt;Hashtable&gt;] [-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;]
[-WarningAction &lt;ActionPreference&gt;] [-ErrorVariable &lt;String&gt;] [-WarningVariable
&lt;String&gt;] [-OutVariable &lt;String&gt;] [-OutBuffer &lt;Int32&gt;] Select-Xml
[-XPath] &lt;String&gt; [-Content] &lt;String[]&gt; [-Namespace &lt;Hashtable&gt;]
[-Verbose] [-Debug] [-ErrorAction &lt;ActionPreference&gt;] [-WarningAction &lt;ActionPreference&gt;]
[-ErrorVariable &lt;String&gt;] [-WarningVariable &lt;String&gt;] [-OutVariable &lt;String&gt;]
[-OutBuffer &lt;Int32&gt;] 
</td>
            </tr>
            <tr>
              <td>
ConvertTo-Xml</td>
              <td>
Creates an XML-based representation of an object.</td>
            </tr>
          </tbody>
        </table>
        <p>
Whew, that’s quite a few. Now, onto the API.
</p>
        <h4>.NET API Differences
</h4>
        <p>
This time, I’m just dumping out the namespaces and Types per namespace. It would be
a bit much to dump out all the Types themselves. The one-liner:
</p>
        <div id="hlDiv" class="dp-highlighter">
          <div class="bar">
          </div>
          <ol class="dp-rb">
            <li class="alt">
              <span>
                <span class="variable">$v1</span>
                <span>.api | group namespace | select name,
count | convertto-html -fragment &gt; .\v1-types.htm  </span>
              </span>
            </li>
          </ol>
        </div>
        <strong>v1.0 RTM API </strong>
        <p>
Here are the namspaces and respective public Type count for v1.0:
</p>
        <table>
          <colgroup>
            <col />
            <col />
          </colgroup>
          <tbody>
            <tr>
              <th>
Name</th>
              <th>
Count</th>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell.Commands</td>
              <td>
196</td>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell</td>
              <td>
11</td>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell.Commands.Internal.Format</td>
              <td>
4</td>
            </tr>
            <tr>
              <td>
System.Management.Automation</td>
              <td>
169</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Internal</td>
              <td>
6</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Host</td>
              <td>
15</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Runspaces</td>
              <td>
33</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Provider</td>
              <td>
13</td>
            </tr>
          </tbody>
        </table>
        <p>
          <strong>v2.0 CTP3 API </strong>
        </p>
        <p>
Here are the namspaces and respective public Type count for v2.0 CTP3:
</p>
        <table>
          <colgroup>
            <col />
            <col />
          </colgroup>
          <tbody>
            <tr>
              <th>
Name</th>
              <th>
Count</th>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell.Commands</td>
              <td>
311</td>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell.Commands.GetCounter</td>
              <td>
4</td>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell</td>
              <td>
14</td>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell.Commands.Internal.Format</td>
              <td>
4</td>
            </tr>
            <tr>
              <td>
Microsoft.WSMan.Management</td>
              <td>
40</td>
            </tr>
            <tr>
              <td>
System.Management.Automation</td>
              <td>
262</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Internal</td>
              <td>
7</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Runspaces</td>
              <td>
61</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Host</td>
              <td>
17</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Remoting</td>
              <td>
10</td>
            </tr>
            <tr>
              <td>
System.Management.Automation.Provider</td>
              <td>
14</td>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell.Commands.Internal</td>
              <td>
4</td>
            </tr>
            <tr>
              <td>
Microsoft.PowerShell.Commands.Management</td>
              <td>
1</td>
            </tr>
          </tbody>
        </table>
        <p>
As you can see, there has been a nice expansion of namespaces and Types to work with,
mostly coming from the sterling work being done to generalize the “Jobs” infrastructure.
Also, a fair chunk is tied up with the refactoring and reorganizing of Runspaces to
allow for jobs (which also covers eventing), remoting and background pipelines. This
is something I will cover in more detail in a future post.
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=f33b33fb-273a-4c45-9695-cdcc0c768aaf" />
      </body>
      <title>Differences between PowerShell 1.0 RTM and Powershell 2.0 CTP3/Win7 Beta</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,f33b33fb-273a-4c45-9695-cdcc0c768aaf.aspx</guid>
      <link>http://www.nivot.org/2009/02/04/DifferencesBetweenPowerShell10RTMAndPowershell20CTP3Win7Beta.aspx</link>
      <pubDate>Wed, 04 Feb 2009 00:18:14 GMT</pubDate>
      <description>&lt;p&gt;
It’s been quite a few years -- November 14, 2006 to be exact -- since the final release
of &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;PowerShell&lt;/a&gt; 1.0.
Let’s see what the &lt;a href="http://blogs.msdn.com/powershell" target="_blank"&gt;lazy
buggers&lt;/a&gt; have been up to since then. Only kidding, they’re far from lazy; we’ve
gained an extra one hundred and six new cmdlets, moving from 131 to 237. We’ve also
gained another provider, WSManProvider which lets you explore and manipulate the WS-Man
configuration. Finally, the number of public Types (.NET classes usable by 3rd parties
to extend PowerShell) has increased from 447 to 749. So how do I know all this? Well,
some months ago I wrote a suite of build analysis Cmdlets for examining the assemblies
that comprise PowerShell. In its current form it’s of very little use to 3rd parties,
but I’ve had some requests to open it up and allow it to analyze any binary modules
and snap-ins, which is a good idea I think. Watch this space. Anyway, I’m going to
dump out some interest information on the differences between v1.0 and v2.0 CTP3,
along with the one-liners I’m using to generate the information. 
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;&lt;strong&gt;update feb 5&lt;/strong&gt;: added breaking changes&lt;/em&gt;
&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;Breaking Changes to Windows PowerShell 1.0&lt;/b&gt;&lt;u&gt;&lt;/u&gt;
&lt;/h4&gt;
&lt;p&gt;
&lt;u&gt;&lt;/u&gt; 
&lt;p&gt;
The following changes in Windows PowerShell V2.0 CTP3 might prevent features designed
for Windows PowerShell 1.0 from working correctly.&lt;u&gt;&lt;/u&gt; 
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="left"&gt;The value of the &lt;b&gt;PowerShellVersion&lt;/b&gt; registry entry in HKLM\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine
has been changed to &lt;b&gt;2.0&lt;/b&gt;.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="left"&gt;New cmdlets and variables have been added. These are listed below.
These new elements might conflict with variables and functions in profiles and scripts.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="left"&gt;&lt;b&gt;-&lt;/b&gt;IEQ operator does a case insensitive comparison on characters.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="left"&gt;Get-Command gets functions along with cmdlets by default. 
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="left"&gt;Any native command that generates a user interface blocks if it
is pipelined to the Out-Host cmdlet.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="left"&gt;Added new language keywords: &lt;b&gt;Begin&lt;/b&gt;, &lt;strong&gt;Process, &lt;/strong&gt;and&lt;strong&gt; End&lt;/strong&gt;.
Any commands called &lt;b&gt;begin&lt;/b&gt;, &lt;b&gt;process&lt;/b&gt; or &lt;b&gt;end&lt;/b&gt; are interpreted as
language keywords and might result in parsing errors. 
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="left"&gt;Cmdlet name resolution has changed. In Windows PowerShell 1.0, a
runtime error was generated when two Windows PowerShell snap-ins exported cmdlets
with the same name. In Windows PowerShell V2, the last cmdlet loaded is the one that
is executed if the cmdlet name is not qualified by a snap-in name.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="left"&gt;Terminating errors that are thrown in a pipeline do not terminate
the pipeline. Instead, they are written to the host. 
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="left"&gt;A function called with '-?' parameter gets the help topic for the
function, if one is included in the function. 
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
There are no changes to Cmdlets other than Get-Command’s –PSSnapin parameter is now
an alias to a –Module parameter. This reflects the move away from administrator-installed
snap-ins, and towards the friendlier Module system. For all intents and purposes,
you can treat v1 snapins as modules as load them as such with the Import-Module Cmdlet.
&lt;/p&gt;
&lt;h4&gt;New Cmdlets
&lt;/h4&gt;
&lt;p&gt;
Here are the new Cmdlets, sorted by noun and alongside the textual synopsis is one
is present in the CTP3 help, or the syntax if there is no help. The command I ran
to generate this was:
&lt;/p&gt;
&lt;p&gt;
&lt;!-- Stylesheet link --&gt;
&lt;link rel="stylesheet" type="text/css" href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css"&gt;
&lt;!-- Code --&gt;&gt;
&lt;div id="hlDiv" class="dp-highlighter"&gt;
&lt;div class="bar"&gt;
&lt;/div&gt;
&lt;ol class="dp-rb"&gt;
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span&gt;compare-psbuildinfo (import-psbuildinfo .\rtm-6-0-6000-16386.psbuild)
(import-psbuildinfo .\win7beta1-6-1-7000-0.psbuild) | ? {&lt;/span&gt;&lt;span class="variable"&gt;$_&lt;/span&gt;&lt;span&gt;.diff
-eq &lt;/span&gt;&lt;span class="string"&gt;"Added"&lt;/span&gt;&lt;span&gt;} | sort noun | % { &lt;/span&gt;&lt;span class="variable"&gt;$_&lt;/span&gt;&lt;span&gt; |
add-member -name Synopsis -member noteproperty -value (&amp;amp; &lt;/span&gt;&lt;span class="variable"&gt;$_&lt;/span&gt;&lt;span&gt;.name
-?&lt;/span&gt;&lt;span class="variable"&gt;|select&lt;/span&gt;&lt;span&gt; -expand synopsis) -passthru }
| select name,synopsis | convertto-html -fragment &amp;gt; new-cmdlets.htm&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;style type="text/css"&gt;&lt;!--
#cmdlets tr td { vertical-align: top; border-top: 1px solid gray; text-align: left; }
--&gt;&lt;/style&gt;
&lt;table id="cmdlets"&gt;
&lt;colgroup&gt;
&lt;col&gt;
&lt;col&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;
Name&lt;/th&gt;
&lt;th&gt;
Synopsis&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Invoke-Command&lt;/td&gt;
&lt;td&gt;
Runs commands on local and remote computers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Add-Computer&lt;/td&gt;
&lt;td&gt;
Adds computers to a domain or workgroup.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-Computer&lt;/td&gt;
&lt;td&gt;
Removes computers from workgroups or domains.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Rename-Computer&lt;/td&gt;
&lt;td&gt;
Renames a computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Restore-Computer&lt;/td&gt;
&lt;td&gt;
Starts a system restore on the local computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Checkpoint-Computer&lt;/td&gt;
&lt;td&gt;
Creates a system restore point on the local computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Restart-Computer&lt;/td&gt;
&lt;td&gt;
Restarts ("reboots") the operating system on local and remote computers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Stop-Computer&lt;/td&gt;
&lt;td&gt;
Stops (shuts down) local and remote computers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Reset-ComputerMachinePassword&lt;/td&gt;
&lt;td&gt;
Resets the machine account password for the computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Disable-ComputerRestore&lt;/td&gt;
&lt;td&gt;
Disables the System Restore feature on the specified file system drive.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Enable-ComputerRestore&lt;/td&gt;
&lt;td&gt;
Enables the System Restore feature on the specified file system drive.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-ComputerRestorePoint&lt;/td&gt;
&lt;td&gt;
Gets the restore points on the local computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Test-ComputerSecureChannel&lt;/td&gt;
&lt;td&gt;
Test-ComputerSecureChannel [-Repair] [-Server &amp;lt;String&amp;gt;] [-Verbose] [-Debug]
[-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] [-WhatIf] [-Confirm] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Test-Connection&lt;/td&gt;
&lt;td&gt;
Sends ICMP echo request packets ("pings") to one or more computers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Export-Counter&lt;/td&gt;
&lt;td&gt;
The Export-Counter cmdlet takes PerformanceCounterSampleSet objects and exports them
as counter log files.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Import-Counter&lt;/td&gt;
&lt;td&gt;
Imports performance counter log files (.blg, .csv, .tsv) and creates the objects that
represent each counter sample in the log.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-Counter&lt;/td&gt;
&lt;td&gt;
Gets performance counter data from local and remote computers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
ConvertFrom-Csv&lt;/td&gt;
&lt;td&gt;
Converts object properties in CSV format into CSV versions of the original objects.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
ConvertTo-Csv&lt;/td&gt;
&lt;td&gt;
Converts .NET objects into a series of comma-separated, variable-length (CSV) strings.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Register-EngineEvent&lt;/td&gt;
&lt;td&gt;
Register-EngineEvent [-SourceIdentifier] &amp;lt;String&amp;gt; [[-Action] &amp;lt;ScriptBlock&amp;gt;]
[-MessageData &amp;lt;PSObject&amp;gt;] [-SupportEvent] [-Forward] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Unregister-Event&lt;/td&gt;
&lt;td&gt;
Unregister-Event [-SourceIdentifier] &amp;lt;String&amp;gt; [-Force] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] [-WhatIf] [-Confirm] Unregister-Event [-SubscriptionId] &amp;lt;Int32&amp;gt;
[-Force] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] [-WhatIf] [-Confirm] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-Event&lt;/td&gt;
&lt;td&gt;
New-Event [-SourceIdentifier] &amp;lt;String&amp;gt; [[-Sender] &amp;lt;PSObject&amp;gt;] [[-EventArguments]
&amp;lt;PSObject[]&amp;gt;] [[-MessageData] &amp;lt;PSObject&amp;gt;] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-Event&lt;/td&gt;
&lt;td&gt;
Remove-Event [-SourceIdentifier] &amp;lt;String&amp;gt; [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] [-WhatIf] [-Confirm] Remove-Event [-EventIdentifier] &amp;lt;Int32&amp;gt;
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] [-WhatIf] [-Confirm] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Wait-Event&lt;/td&gt;
&lt;td&gt;
Wait-Event [[-SourceIdentifier] &amp;lt;String&amp;gt;] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-Event&lt;/td&gt;
&lt;td&gt;
Get-Event [[-SourceIdentifier] &amp;lt;String&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Show-EventLog&lt;/td&gt;
&lt;td&gt;
Displays the event logs of the local or a remote computer in Event Viewer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-EventLog&lt;/td&gt;
&lt;td&gt;
Creates a new event log and a new event source on a local or remote computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-EventLog&lt;/td&gt;
&lt;td&gt;
Deletes an event log or unregisters an event source.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Clear-EventLog&lt;/td&gt;
&lt;td&gt;
Deletes all entries from specified event logs on the local or remote computers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Write-EventLog&lt;/td&gt;
&lt;td&gt;
Writes an event to an event log.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Limit-EventLog&lt;/td&gt;
&lt;td&gt;
Sets the event log properties that limit the size of the event log and the age of
its entries.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-EventSubscriber&lt;/td&gt;
&lt;td&gt;
Get-EventSubscriber [[-SourceIdentifier] &amp;lt;String&amp;gt;] [-Force] [-Verbose] [-Debug]
[-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Export-FormatData&lt;/td&gt;
&lt;td&gt;
Export-FormatData [-InputObject &amp;lt;ExtendedTypeDefinition[]&amp;gt;] [-FilePath &amp;lt;String&amp;gt;]
[-Force] [-NoClobber] [-IncludeScriptBlock] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-FormatData&lt;/td&gt;
&lt;td&gt;
Get-FormatData [[-TypeName] &amp;lt;String[]&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Out-GridView&lt;/td&gt;
&lt;td&gt;
Sends output to an interactive table in a separate window.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Clear-History&lt;/td&gt;
&lt;td&gt;
Deletes entries from the command history.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-HotFix&lt;/td&gt;
&lt;td&gt;
Gets the QFE updates that have been applied to the local and remote computers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Stop-Job&lt;/td&gt;
&lt;td&gt;
Stops a Windows PowerShell background job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Wait-Job&lt;/td&gt;
&lt;td&gt;
Suppresses the command prompt until one or all of the Windows PowerShell background
jobs running in the session are complete.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-Job&lt;/td&gt;
&lt;td&gt;
Deletes a Windows PowerShell background job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Start-Job&lt;/td&gt;
&lt;td&gt;
Starts a Windows PowerShell background job.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-Job&lt;/td&gt;
&lt;td&gt;
Gets Windows PowerShell background jobs that are running in the current session.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Receive-Job&lt;/td&gt;
&lt;td&gt;
Gets the results of the Windows PowerShell background jobs in the current session.
You can use this cmdlet to retrieve the output and errors of background jobs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Update-List&lt;/td&gt;
&lt;td&gt;
Adds and removes items from a property value that contains a collection of objects.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Import-LocalizedData&lt;/td&gt;
&lt;td&gt;
Imports language-specific data into scripts and functions based on the UI culture
that is selected for the operating system.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Send-MailMessage&lt;/td&gt;
&lt;td&gt;
Sends an e-mail message.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-Module&lt;/td&gt;
&lt;td&gt;
Get-Module [[-Name] &amp;lt;String[]&amp;gt;] [-All] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] Get-Module
[[-Name] &amp;lt;String[]&amp;gt;] [-ListAvailable] [-Recurse] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-Module&lt;/td&gt;
&lt;td&gt;
Remove-Module [-Name] &amp;lt;String[]&amp;gt; [-Force] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] [-WhatIf] [-Confirm] Remove-Module [-ModuleInfo] &amp;lt;PSModuleInfo[]&amp;gt;
[-Force] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] [-WhatIf] [-Confirm] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-Module&lt;/td&gt;
&lt;td&gt;
New-Module [-ScriptBlock] &amp;lt;ScriptBlock&amp;gt; [-Function &amp;lt;String[]&amp;gt;] [-Cmdlet
&amp;lt;String[]&amp;gt;] [-ReturnResult] [-AsCustomObject] [-ArgumentList &amp;lt;Object[]&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] New-Module [-Name] &amp;lt;String&amp;gt; [-ScriptBlock] &amp;lt;ScriptBlock&amp;gt;
[-Function &amp;lt;String[]&amp;gt;] [-Cmdlet &amp;lt;String[]&amp;gt;] [-ReturnResult] [-AsCustomObject]
[-ArgumentList &amp;lt;Object[]&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Import-Module&lt;/td&gt;
&lt;td&gt;
Import-Module [-Name] &amp;lt;String[]&amp;gt; [-Prefix &amp;lt;String&amp;gt;] [-Function &amp;lt;String[]&amp;gt;]
[-Cmdlet &amp;lt;String[]&amp;gt;] [-Variable &amp;lt;String[]&amp;gt;] [-Alias &amp;lt;String[]&amp;gt;]
[-Force] [-PassThru] [-AsCustomObject] [-Version &amp;lt;Version&amp;gt;] [-ArgumentList &amp;lt;Object[]&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] Import-Module [-Assembly] &amp;lt;Assembly[]&amp;gt; [-Prefix &amp;lt;String&amp;gt;]
[-Function &amp;lt;String[]&amp;gt;] [-Cmdlet &amp;lt;String[]&amp;gt;] [-Variable &amp;lt;String[]&amp;gt;]
[-Alias &amp;lt;String[]&amp;gt;] [-Force] [-PassThru] [-AsCustomObject] [-Version &amp;lt;Version&amp;gt;]
[-ArgumentList &amp;lt;Object[]&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] Import-Module
[-ModuleInfo] &amp;lt;PSModuleInfo[]&amp;gt; [-Prefix &amp;lt;String&amp;gt;] [-Function &amp;lt;String[]&amp;gt;]
[-Cmdlet &amp;lt;String[]&amp;gt;] [-Variable &amp;lt;String[]&amp;gt;] [-Alias &amp;lt;String[]&amp;gt;]
[-Force] [-PassThru] [-AsCustomObject] [-Version &amp;lt;Version&amp;gt;] [-ArgumentList &amp;lt;Object[]&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Test-ModuleManifest&lt;/td&gt;
&lt;td&gt;
Test-ModuleManifest [-Path] &amp;lt;String&amp;gt; [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-ModuleManifest&lt;/td&gt;
&lt;td&gt;
New-ModuleManifest [-Path] &amp;lt;String&amp;gt; -NestedModules &amp;lt;String[]&amp;gt; [-Guid &amp;lt;Guid&amp;gt;]
-Author &amp;lt;String&amp;gt; -CompanyName &amp;lt;String&amp;gt; -Copyright &amp;lt;String&amp;gt; [-ModuleToProcess
&amp;lt;String&amp;gt;] [-ModuleVersion &amp;lt;Version&amp;gt;] -Description &amp;lt;String&amp;gt; [-PowerShellVersion
&amp;lt;Version&amp;gt;] [-ClrVersion &amp;lt;Version&amp;gt;] [-RequiredModules &amp;lt;IDictionary[]&amp;gt;]
-TypesToProcess &amp;lt;String[]&amp;gt; -FormatsToProcess &amp;lt;String[]&amp;gt; [-ScriptsToProcess
&amp;lt;String[]&amp;gt;] -RequiredAssemblies &amp;lt;String[]&amp;gt; -OtherFiles &amp;lt;String[]&amp;gt;
[-ExportedFunctions &amp;lt;String[]&amp;gt;] [-ExportedAliases &amp;lt;String[]&amp;gt;] [-ExportedVariables
&amp;lt;String[]&amp;gt;] [-ExportedCmdlets &amp;lt;String[]&amp;gt;] [-PrivateData &amp;lt;Object&amp;gt;]
[-PassThru] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] [-WhatIf] [-Confirm] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Export-ModuleMember&lt;/td&gt;
&lt;td&gt;
Export-ModuleMember [[-Function] &amp;lt;String[]&amp;gt;] [-Cmdlet &amp;lt;String[]&amp;gt;] [-Variable
&amp;lt;String[]&amp;gt;] [-Alias &amp;lt;String[]&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Register-ObjectEvent&lt;/td&gt;
&lt;td&gt;
Register-ObjectEvent [-InputObject] &amp;lt;PSObject&amp;gt; [-EventName] &amp;lt;String&amp;gt; [[-SourceIdentifier]
&amp;lt;String&amp;gt;] [[-Action] &amp;lt;ScriptBlock&amp;gt;] [-MessageData &amp;lt;PSObject&amp;gt;] [-SupportEvent]
[-Forward] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Start-Process&lt;/td&gt;
&lt;td&gt;
Starts one or more processes on the local computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Debug-Process&lt;/td&gt;
&lt;td&gt;
Debugs one or more processes running on the local computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Wait-Process&lt;/td&gt;
&lt;td&gt;
Waits for the processes to be stopped before accepting more input.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Enable-PSBreakpoint&lt;/td&gt;
&lt;td&gt;
Enables the breakpoints in the current console.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Disable-PSBreakpoint&lt;/td&gt;
&lt;td&gt;
Disables the breakpoints in the current console.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-PSBreakpoint&lt;/td&gt;
&lt;td&gt;
Deletes breakpoints from the current console.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Set-PSBreakpoint&lt;/td&gt;
&lt;td&gt;
Sets a breakpoint on a line, command, or variable.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-PSBreakpoint&lt;/td&gt;
&lt;td&gt;
Gets the breakpoints that are set in the current console.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-PSCallStack&lt;/td&gt;
&lt;td&gt;
Displays the current call stack.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-PSSession&lt;/td&gt;
&lt;td&gt;
Closes one or more Windows PowerShell sessions (PSSessions).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Enter-PSSession&lt;/td&gt;
&lt;td&gt;
Starts an interactive session with a remote computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Exit-PSSession&lt;/td&gt;
&lt;td&gt;
Ends an interactive session with a remote computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-PSSession&lt;/td&gt;
&lt;td&gt;
Gets the Windows PowerShell sessions (PSSessions) in the current session.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Export-PSSession&lt;/td&gt;
&lt;td&gt;
Saves commands from another session in a script module file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Import-PSSession&lt;/td&gt;
&lt;td&gt;
Imports cmdlets, aliases, functions, and other command types from another session
on a local or remote computer into the current session.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-PSSession&lt;/td&gt;
&lt;td&gt;
Creates a persistent connection to a local or remote computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Set-PSSessionConfiguration&lt;/td&gt;
&lt;td&gt;
Set-PSSessionConfiguration [-Name] &amp;lt;String&amp;gt; [-ApplicationBase &amp;lt;String&amp;gt;]
[-ThreadApartmentState &amp;lt;ApartmentState&amp;gt;] [-ThreadOptions &amp;lt;PSThreadOptions&amp;gt;]
[-StartupScript &amp;lt;String&amp;gt;] [-MaximumReceivedDataSizePerCommandMB &amp;lt;Nullable`1&amp;gt;]
[-MaximumReceivedObjectSizeMB &amp;lt;Nullable`1&amp;gt;] [-SecurityDescriptorSddl &amp;lt;String&amp;gt;]
[-Force] [-NoServiceRestart] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] Set-PSSessionConfiguration
[-Name] &amp;lt;String&amp;gt; [-AssemblyName] &amp;lt;String&amp;gt; [-ConfigurationTypeName] &amp;lt;String&amp;gt;
[-ApplicationBase &amp;lt;String&amp;gt;] [-ThreadApartmentState &amp;lt;ApartmentState&amp;gt;] [-ThreadOptions
&amp;lt;PSThreadOptions&amp;gt;] [-StartupScript &amp;lt;String&amp;gt;] [-MaximumReceivedDataSizePerCommandMB
&amp;lt;Nullable`1&amp;gt;] [-MaximumReceivedObjectSizeMB &amp;lt;Nullable`1&amp;gt;] [-SecurityDescriptorSddl
&amp;lt;String&amp;gt;] [-Force] [-NoServiceRestart] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Enable-PSSessionConfiguration&lt;/td&gt;
&lt;td&gt;
Enable-PSSessionConfiguration [[-Name] &amp;lt;String[]&amp;gt;] [-Force] [-SecurityDescriptorSddl
&amp;lt;String&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Disable-PSSessionConfiguration&lt;/td&gt;
&lt;td&gt;
Disable-PSSessionConfiguration [[-Name] &amp;lt;String[]&amp;gt;] [-Force] [-Verbose] [-Debug]
[-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Register-PSSessionConfiguration&lt;/td&gt;
&lt;td&gt;
Register-PSSessionConfiguration [-Name] &amp;lt;String&amp;gt; [-ProcessorArchitecture &amp;lt;String&amp;gt;]
[-ApplicationBase &amp;lt;String&amp;gt;] [-ThreadApartmentState &amp;lt;ApartmentState&amp;gt;] [-ThreadOptions
&amp;lt;PSThreadOptions&amp;gt;] [-StartupScript &amp;lt;String&amp;gt;] [-MaximumReceivedDataSizePerCommandMB
&amp;lt;Nullable`1&amp;gt;] [-MaximumReceivedObjectSizeMB &amp;lt;Nullable`1&amp;gt;] [-SecurityDescriptorSddl
&amp;lt;String&amp;gt;] [-Force] [-NoServiceRestart] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] Register-PSSessionConfiguration
[-Name] &amp;lt;String&amp;gt; [-AssemblyName] &amp;lt;String&amp;gt; [-ConfigurationTypeName] &amp;lt;String&amp;gt;
[-ProcessorArchitecture &amp;lt;String&amp;gt;] [-ApplicationBase &amp;lt;String&amp;gt;] [-ThreadApartmentState
&amp;lt;ApartmentState&amp;gt;] [-ThreadOptions &amp;lt;PSThreadOptions&amp;gt;] [-StartupScript &amp;lt;String&amp;gt;]
[-MaximumReceivedDataSizePerCommandMB &amp;lt;Nullable`1&amp;gt;] [-MaximumReceivedObjectSizeMB
&amp;lt;Nullable`1&amp;gt;] [-SecurityDescriptorSddl &amp;lt;String&amp;gt;] [-Force] [-NoServiceRestart]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Unregister-PSSessionConfiguration&lt;/td&gt;
&lt;td&gt;
Unregister-PSSessionConfiguration [-Name] &amp;lt;String&amp;gt; [-Force] [-NoServiceRestart]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-PSSessionConfiguration&lt;/td&gt;
&lt;td&gt;
Get-PSSessionConfiguration [[-Name] &amp;lt;String[]&amp;gt;] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-Random&lt;/td&gt;
&lt;td&gt;
Gets a random number or selects objects randomly from a collection.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Set-StrictMode&lt;/td&gt;
&lt;td&gt;
Establishes and enforces coding rules in expressions, scripts, and script blocks.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
ConvertFrom-StringData&lt;/td&gt;
&lt;td&gt;
Converts a string containing one or more "name=value" pairs to a hash table.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Undo-Transaction&lt;/td&gt;
&lt;td&gt;
Rolls back the active transaction.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Use-Transaction&lt;/td&gt;
&lt;td&gt;
Adds the script block to the active transaction.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Complete-Transaction&lt;/td&gt;
&lt;td&gt;
Commits the active transaction.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-Transaction&lt;/td&gt;
&lt;td&gt;
Gets the current (active) transaction.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Start-Transaction&lt;/td&gt;
&lt;td&gt;
Starts a transaction.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Add-Type&lt;/td&gt;
&lt;td&gt;
Adds a .NET type (a class) to a Windows PowerShell session.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-WebServiceProxy&lt;/td&gt;
&lt;td&gt;
Creates a Web service proxy object that lets you use and manage the Web service in
Windows PowerShell.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-WinEvent&lt;/td&gt;
&lt;td&gt;
Gets events from event logs and event tracing log files on local and remote computers.
This cmdlet runs only on Windows Vista and later versions of Windows.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Register-WmiEvent&lt;/td&gt;
&lt;td&gt;
Register-WmiEvent [-Class] &amp;lt;String&amp;gt; [[-SourceIdentifier] &amp;lt;String&amp;gt;] [[-Action]
&amp;lt;ScriptBlock&amp;gt;] [-Namespace &amp;lt;String&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;]
[-ComputerName &amp;lt;String&amp;gt;] [-Timeout &amp;lt;Int64&amp;gt;] [-MessageData &amp;lt;PSObject&amp;gt;]
[-SupportEvent] [-Forward] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] Register-WmiEvent
[-Query] &amp;lt;String&amp;gt; [[-SourceIdentifier] &amp;lt;String&amp;gt;] [[-Action] &amp;lt;ScriptBlock&amp;gt;]
[-Namespace &amp;lt;String&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-ComputerName &amp;lt;String&amp;gt;]
[-Timeout &amp;lt;Int64&amp;gt;] [-MessageData &amp;lt;PSObject&amp;gt;] [-SupportEvent] [-Forward]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Set-WmiInstance&lt;/td&gt;
&lt;td&gt;
Creates or modifies instances of WMI classes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Invoke-WmiMethod&lt;/td&gt;
&lt;td&gt;
Calls WMI methods.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-WmiObject&lt;/td&gt;
&lt;td&gt;
Deletes WMI classes and instances.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Disconnect-WSMan&lt;/td&gt;
&lt;td&gt;
Disconnect-WSMan [[-ComputerName] &amp;lt;String&amp;gt;] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Connect-WSMan&lt;/td&gt;
&lt;td&gt;
Connect-WSMan [[-ComputerName] &amp;lt;String&amp;gt;] [-ApplicationName &amp;lt;String&amp;gt;] [-Authentication
&amp;lt;AuthenticationMechanism&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;]
[-Port &amp;lt;Int32&amp;gt;] [-SessionOption &amp;lt;SessionOption&amp;gt;] [-UseSSL] [-Verbose]
[-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] Connect-WSMan [-Authentication &amp;lt;AuthenticationMechanism&amp;gt;]
[-ConnectionURI &amp;lt;Uri&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;]
[-Port &amp;lt;Int32&amp;gt;] [-SessionOption &amp;lt;SessionOption&amp;gt;] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Test-WSMan&lt;/td&gt;
&lt;td&gt;
Test-WSMan [[-ComputerName] &amp;lt;String&amp;gt;] [-Authentication &amp;lt;AuthenticationMechanism&amp;gt;]
[-Credential &amp;lt;PSCredential&amp;gt;] [-Port &amp;lt;Int32&amp;gt;] [-UseSSL] [-ApplicationName
&amp;lt;String&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Invoke-WSManAction&lt;/td&gt;
&lt;td&gt;
Invoke-WSManAction [-ResourceURI] &amp;lt;Uri&amp;gt; [-Action] &amp;lt;String&amp;gt; [[-SelectorSet]
&amp;lt;Hashtable&amp;gt;] [-Authentication &amp;lt;AuthenticationMechanism&amp;gt;] [-ConnectionURI
&amp;lt;Uri&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-FilePath &amp;lt;String&amp;gt;] [-OptionSet
&amp;lt;Hashtable&amp;gt;] [-SessionOption &amp;lt;SessionOption&amp;gt;] [-ValueSet &amp;lt;Hashtable&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] Invoke-WSManAction [-ResourceURI] &amp;lt;Uri&amp;gt; [-Action]
&amp;lt;String&amp;gt; [[-SelectorSet] &amp;lt;Hashtable&amp;gt;] [-ApplicationName &amp;lt;String&amp;gt;]
[-Authentication &amp;lt;AuthenticationMechanism&amp;gt;] [-ComputerName &amp;lt;String&amp;gt;] [-Credential
&amp;lt;PSCredential&amp;gt;] [-FilePath &amp;lt;String&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;] [-Port
&amp;lt;Int32&amp;gt;] [-SessionOption &amp;lt;SessionOption&amp;gt;] [-UseSSL] [-ValueSet &amp;lt;Hashtable&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-WSManCredSSP&lt;/td&gt;
&lt;td&gt;
Get-WSManCredSSP [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Enable-WSManCredSSP&lt;/td&gt;
&lt;td&gt;
Enable-WSManCredSSP [-DelegateComputer] &amp;lt;String[]&amp;gt; [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Disable-WSManCredSSP&lt;/td&gt;
&lt;td&gt;
Disable-WSManCredSSP [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Remove-WSManInstance&lt;/td&gt;
&lt;td&gt;
Remove-WSManInstance [-ResourceURI] &amp;lt;Uri&amp;gt; [-SelectorSet] &amp;lt;Hashtable&amp;gt; [-ApplicationName
&amp;lt;String&amp;gt;] [-Authentication &amp;lt;AuthenticationMechanism&amp;gt;] [-ComputerName &amp;lt;String&amp;gt;]
[-Credential &amp;lt;PSCredential&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;] [-Port &amp;lt;Int32&amp;gt;]
[-SessionOption &amp;lt;SessionOption&amp;gt;] [-UseSSL] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] Remove-WSManInstance [-ResourceURI] &amp;lt;Uri&amp;gt; [-SelectorSet] &amp;lt;Hashtable&amp;gt;
[-Authentication &amp;lt;AuthenticationMechanism&amp;gt;] [-ConnectionURI &amp;lt;Uri&amp;gt;] [-Credential
&amp;lt;PSCredential&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;] [-SessionOption &amp;lt;SessionOption&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-WSManInstance&lt;/td&gt;
&lt;td&gt;
New-WSManInstance [-ResourceURI] &amp;lt;Uri&amp;gt; [-SelectorSet] &amp;lt;Hashtable&amp;gt; [-ApplicationName
&amp;lt;String&amp;gt;] [-Authentication &amp;lt;AuthenticationMechanism&amp;gt;] [-ComputerName &amp;lt;String&amp;gt;]
[-Credential &amp;lt;PSCredential&amp;gt;] [-FilePath &amp;lt;String&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;]
[-Port &amp;lt;Int32&amp;gt;] [-SessionOption &amp;lt;SessionOption&amp;gt;] [-UseSSL] [-ValueSet
&amp;lt;Hashtable&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] New-WSManInstance [-ResourceURI]
&amp;lt;Uri&amp;gt; [-SelectorSet] &amp;lt;Hashtable&amp;gt; [-Authentication &amp;lt;AuthenticationMechanism&amp;gt;]
[-ConnectionURI &amp;lt;Uri&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-FilePath &amp;lt;String&amp;gt;]
[-OptionSet &amp;lt;Hashtable&amp;gt;] [-SessionOption &amp;lt;SessionOption&amp;gt;] [-ValueSet &amp;lt;Hashtable&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Get-WSManInstance&lt;/td&gt;
&lt;td&gt;
Get-WSManInstance [-ResourceURI] &amp;lt;Uri&amp;gt; [-ApplicationName &amp;lt;String&amp;gt;] [-Authentication
&amp;lt;AuthenticationMechanism&amp;gt;] [-ComputerName &amp;lt;String&amp;gt;] [-ConnectionURI &amp;lt;Uri&amp;gt;]
[-Credential &amp;lt;PSCredential&amp;gt;] [-Dialect &amp;lt;Uri&amp;gt;] [-Fragment &amp;lt;String&amp;gt;]
[-OptionSet &amp;lt;Hashtable&amp;gt;] [-Port &amp;lt;Int32&amp;gt;] [-SelectorSet &amp;lt;Hashtable&amp;gt;]
[-SessionOption &amp;lt;SessionOption&amp;gt;] [-UseSSL] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] Get-WSManInstance [-ResourceURI] &amp;lt;Uri&amp;gt; [-ApplicationName &amp;lt;String&amp;gt;]
[-Authentication &amp;lt;AuthenticationMechanism&amp;gt;] [-BasePropertiesOnly] [-ComputerName
&amp;lt;String&amp;gt;] [-ConnectionURI &amp;lt;Uri&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-Dialect
&amp;lt;Uri&amp;gt;] -Enumerate [-Filter &amp;lt;String&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;] [-Port
&amp;lt;Int32&amp;gt;] [-References] [-ReturnType &amp;lt;String&amp;gt;] [-SessionOption &amp;lt;SessionOption&amp;gt;]
[-Shallow] [-UseSSL] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction
&amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;]
[-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Set-WSManInstance&lt;/td&gt;
&lt;td&gt;
Set-WSManInstance [-ResourceURI] &amp;lt;Uri&amp;gt; [[-SelectorSet] &amp;lt;Hashtable&amp;gt;] [-ApplicationName
&amp;lt;String&amp;gt;] [-Authentication &amp;lt;AuthenticationMechanism&amp;gt;] [-ComputerName &amp;lt;String&amp;gt;]
[-Credential &amp;lt;PSCredential&amp;gt;] [-Dialect &amp;lt;Uri&amp;gt;] [-FilePath &amp;lt;String&amp;gt;]
[-Fragment &amp;lt;String&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;] [-Port &amp;lt;Int32&amp;gt;] [-SessionOption
&amp;lt;SessionOption&amp;gt;] [-UseSSL] [-ValueSet &amp;lt;Hashtable&amp;gt;] [-Verbose] [-Debug]
[-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] Set-WSManInstance [-ResourceURI] &amp;lt;Uri&amp;gt; [[-SelectorSet]
&amp;lt;Hashtable&amp;gt;] [-Authentication &amp;lt;AuthenticationMechanism&amp;gt;] [-ConnectionURI
&amp;lt;Uri&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-Dialect &amp;lt;Uri&amp;gt;] [-FilePath
&amp;lt;String&amp;gt;] [-Fragment &amp;lt;String&amp;gt;] [-OptionSet &amp;lt;Hashtable&amp;gt;] [-SessionOption
&amp;lt;SessionOption&amp;gt;] [-ValueSet &amp;lt;Hashtable&amp;gt;] [-Verbose] [-Debug] [-ErrorAction
&amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable
&amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer
&amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Set-WSManQuickConfig&lt;/td&gt;
&lt;td&gt;
Set-WSManQuickConfig [-UseSSL] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
New-WSManSessionOption&lt;/td&gt;
&lt;td&gt;
New-WSManSessionOption [-ProxyAccessType &amp;lt;ProxyAccessType&amp;gt;] [-ProxyAuthentication
&amp;lt;ProxyAuthentication&amp;gt;] [-ProxyCredential &amp;lt;PSCredential&amp;gt;] [-SkipCACheck]
[-SkipCNCheck] [-SkipRevocationCheck] [-SPNPort &amp;lt;Int32&amp;gt;] [-OperationTimeout
&amp;lt;Int32&amp;gt;] [-NoEncryption] [-UseUTF16] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Select-Xml&lt;/td&gt;
&lt;td&gt;
Select-Xml [-XPath] &amp;lt;String&amp;gt; [-Path] &amp;lt;String[]&amp;gt; [-Namespace &amp;lt;Hashtable&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] Select-Xml [-XPath] &amp;lt;String&amp;gt; [-Xml] &amp;lt;XmlNode[]&amp;gt;
[-Namespace &amp;lt;Hashtable&amp;gt;] [-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;]
[-WarningAction &amp;lt;ActionPreference&amp;gt;] [-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable
&amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;] [-OutBuffer &amp;lt;Int32&amp;gt;] Select-Xml
[-XPath] &amp;lt;String&amp;gt; [-Content] &amp;lt;String[]&amp;gt; [-Namespace &amp;lt;Hashtable&amp;gt;]
[-Verbose] [-Debug] [-ErrorAction &amp;lt;ActionPreference&amp;gt;] [-WarningAction &amp;lt;ActionPreference&amp;gt;]
[-ErrorVariable &amp;lt;String&amp;gt;] [-WarningVariable &amp;lt;String&amp;gt;] [-OutVariable &amp;lt;String&amp;gt;]
[-OutBuffer &amp;lt;Int32&amp;gt;] 
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
ConvertTo-Xml&lt;/td&gt;
&lt;td&gt;
Creates an XML-based representation of an object.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
Whew, that’s quite a few. Now, onto the API.
&lt;/p&gt;
&lt;h4&gt;.NET API Differences
&lt;/h4&gt;
&lt;p&gt;
This time, I’m just dumping out the namespaces and Types per namespace. It would be
a bit much to dump out all the Types themselves. The one-liner:
&lt;/p&gt;
&lt;div id="hlDiv" class="dp-highlighter"&gt;
&lt;div class="bar"&gt;
&lt;/div&gt;
&lt;ol class="dp-rb"&gt;
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="variable"&gt;$v1&lt;/span&gt;&lt;span&gt;.api | group namespace | select name,
count | convertto-html -fragment &amp;gt; .\v1-types.htm&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;strong&gt;v1.0 RTM API &lt;/strong&gt; 
&lt;p&gt;
Here are the namspaces and respective public Type count for v1.0:
&lt;/p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col&gt;
&lt;col&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;
Name&lt;/th&gt;
&lt;th&gt;
Count&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell.Commands&lt;/td&gt;
&lt;td&gt;
196&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell&lt;/td&gt;
&lt;td&gt;
11&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell.Commands.Internal.Format&lt;/td&gt;
&lt;td&gt;
4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation&lt;/td&gt;
&lt;td&gt;
169&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Internal&lt;/td&gt;
&lt;td&gt;
6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Host&lt;/td&gt;
&lt;td&gt;
15&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Runspaces&lt;/td&gt;
&lt;td&gt;
33&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Provider&lt;/td&gt;
&lt;td&gt;
13&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
&lt;strong&gt;v2.0 CTP3 API &lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Here are the namspaces and respective public Type count for v2.0 CTP3:
&lt;/p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col&gt;
&lt;col&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;
Name&lt;/th&gt;
&lt;th&gt;
Count&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell.Commands&lt;/td&gt;
&lt;td&gt;
311&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell.Commands.GetCounter&lt;/td&gt;
&lt;td&gt;
4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell&lt;/td&gt;
&lt;td&gt;
14&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell.Commands.Internal.Format&lt;/td&gt;
&lt;td&gt;
4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.WSMan.Management&lt;/td&gt;
&lt;td&gt;
40&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation&lt;/td&gt;
&lt;td&gt;
262&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Internal&lt;/td&gt;
&lt;td&gt;
7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Runspaces&lt;/td&gt;
&lt;td&gt;
61&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Host&lt;/td&gt;
&lt;td&gt;
17&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Remoting&lt;/td&gt;
&lt;td&gt;
10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
System.Management.Automation.Provider&lt;/td&gt;
&lt;td&gt;
14&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell.Commands.Internal&lt;/td&gt;
&lt;td&gt;
4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Microsoft.PowerShell.Commands.Management&lt;/td&gt;
&lt;td&gt;
1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
As you can see, there has been a nice expansion of namespaces and Types to work with,
mostly coming from the sterling work being done to generalize the “Jobs” infrastructure.
Also, a fair chunk is tied up with the refactoring and reorganizing of Runspaces to
allow for jobs (which also covers eventing), remoting and background pipelines. This
is something I will cover in more detail in a future post.
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=f33b33fb-273a-4c45-9695-cdcc0c768aaf" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,f33b33fb-273a-4c45-9695-cdcc0c768aaf.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>CTP3</category>
      <category>Modules</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=3e82586b-d5c3-4e0d-883a-74e22919247c</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,3e82586b-d5c3-4e0d-883a-74e22919247c.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,3e82586b-d5c3-4e0d-883a-74e22919247c.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=3e82586b-d5c3-4e0d-883a-74e22919247c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just to be completely silly, I thought I’d do a series of posts on CTP3 features themed
around Christmas. Hmm. That might read better as a series of Christmas posts themed
around CTP3. A very original idea I’m sure, but hey, those who know me will know that
I never pass up the opportunity to make a bad joke. So, without further adieu:
</p>
        <p>
On the first day of Christmas, <a href="http://twitter.com/jsnover" target="_blank">Jeffrey</a> gave
to me: 
</p>
        <h3>Nested Here-Strings
</h3>
        <p>
Here-Strings can now be embedded within each other to make it even easier to construct
literal documents! Delimit any nested code between $( and ) and then continue to use
a nested string within that as if it was completely stand alone. It just works! Cool,
eh?
</p>
        <!-- Stylesheet link -->
        <link href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css" type="text/css" rel="stylesheet" />
        <!-- Code -->
        <div class="dp-highlighter" id="hlDiv">
          <div class="bar">
          </div>
          <ol class="dp-rb">
            <li class="alt">
              <span>
                <span class="keyword">function</span>
                <span> Get-CommandDefinitionHtml {   </span>
              </span>
            </li>
            <li class="">
              <span>       </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="comment"># this tells powershell to allow
advanced features, </span>
              <span>  </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="comment"># like the [validatenotnullorempty()]
attribute below. </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>    [CmdletBinding()]   </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="keyword">param</span>
              <span>(   </span>
            </li>
            <li class="alt">
              <span>        [ValidateNotNullOrEmpty()]   </span>
            </li>
            <li class="">
              <span>        [string]</span>
              <span class="variable">$name</span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>    )   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="variable">$command</span>
              <span> = get-command </span>
              <span class="variable">$name</span>
              <span>  </span>
            </li>
            <li class="">
              <span>       </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="comment"># Look mom! I'm a cmdlet! </span>
              <span>  </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="variable">$PSCmdlet</span>
              <span>.WriteVerbose(</span>
              <span class="string">"Dumping
HTML for "</span>
              <span> + </span>
              <span class="variable">$command</span>
              <span>)   </span>
            </li>
            <li class="alt">
              <span>       </span>
            </li>
            <li class="">
              <span>@</span>
              <span class="string">" </span>  
</li>
            <li class="alt">
              <span>
                <span class="string">    &lt;html&gt; </span> </span>
            </li>
            <li class="">
              <span>
                <span class="string">        &lt;head&gt; </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">           
&lt;title&gt;$($command.name)&lt;/title&gt; </span> </span>
            </li>
            <li class="">
              <span>
                <span class="string">        &lt;/head&gt; </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">        &lt;body&gt; </span> </span>
            </li>
            <li class="">
              <span>
                <span class="string">           
&lt;table border="</span>
                <span>1</span>
                <span class="string">"&gt; </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">$( </span> </span>
            </li>
            <li class="">
              <span>
                <span class="string">    $command.parametersets | % { </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">@"</span>
                <span>  </span>
              </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>            &lt;tr&gt;   </span>
            </li>
            <li class="">
              <span>               
&lt;td&gt;$(</span>
              <span class="variable">$_</span>
              <span>.name)&lt;/td&gt;   </span>
            </li>
            <li class="alt">
              <span>               
&lt;td&gt;   </span>
            </li>
            <li class="">
              <span>                   
&lt;table border=</span>
              <span class="string">"1"</span>
              <span>&gt;   </span>
            </li>
            <li class="alt">
              <span>                       
&lt;tr&gt;   </span>
            </li>
            <li class="">
              <span>                           
&lt;th colspan=</span>
              <span class="string">"8"</span>
              <span>&gt;Parameters&lt;/th&gt;   </span>
            </li>
            <li class="alt">
              <span>                               </span>
            </li>
            <li class="">
              <span>$(   </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="variable">$count</span>
              <span> =
0   </span>
            </li>
            <li class="">
              <span>        </span>
              <span class="variable">$_</span>
              <span>.parameters
| % {   </span>
            </li>
            <li class="alt">
              <span>            </span>
              <span class="keyword">if</span>
              <span> (0
-eq (</span>
              <span class="variable">$count</span>
              <span> % 8)) {   </span>
            </li>
            <li class="">
              <span>@</span>
              <span class="string">" </span>  
</li>
            <li class="alt">
              <span>
                <span class="string">                       
&lt;/tr&gt; </span> </span>
            </li>
            <li class="">
              <span>
                <span class="string">                       
&lt;tr&gt; </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">"</span>
                <span>@   </span>
              </span>
            </li>
            <li class="">
              <span>            }                   </span>
            </li>
            <li class="alt">
              <span>@</span>
              <span class="string">" </span>  
</li>
            <li class="">
              <span>
                <span class="string">                           
&lt;td&gt;$($_.name)&lt;/td&gt; </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">"</span>
                <span>@               </span>
              </span>
            </li>
            <li class="">
              <span>            </span>
              <span class="variable">$count</span>
              <span>++   </span>
            </li>
            <li class="alt">
              <span>    }   </span>
            </li>
            <li class="">
              <span>)   </span>
            </li>
            <li class="alt">
              <span>                       
&lt;/tr&gt;                           </span>
            </li>
            <li class="">
              <span>                   
&lt;/table&gt;   </span>
            </li>
            <li class="alt">
              <span>               
&lt;/td&gt;   </span>
            </li>
            <li class="">
              <span>            &lt;/tr&gt;   </span>
            </li>
            <li class="alt">
              <span>
              </span>
              <span class="string">"@ </span>  
</li>
            <li class="">
              <span>
                <span class="string">    } </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">) </span> </span>
            </li>
            <li class="">
              <span>
                <span class="string">           
&lt;/table&gt;         </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">        &lt;/body&gt; </span> </span>
            </li>
            <li class="">
              <span>
                <span class="string">    &lt;/html&gt; </span> </span>
            </li>
            <li class="alt">
              <span>
                <span class="string">"</span>
                <span>@       </span>
              </span>
            </li>
            <li class="">
              <span>}   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>Get-CommandDefinitionHtml get-item &gt; out.html   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>
              </span>
              <span class="comment"># show in browser </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>invoke-item out.html  </span>
            </li>
          </ol>
        </div>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=3e82586b-d5c3-4e0d-883a-74e22919247c" />
      </body>
      <title>The Twelve days of PowerShell 2.0 CTP3!</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,3e82586b-d5c3-4e0d-883a-74e22919247c.aspx</guid>
      <link>http://www.nivot.org/2008/12/23/TheTwelveDaysOfPowerShell20CTP3.aspx</link>
      <pubDate>Tue, 23 Dec 2008 21:16:03 GMT</pubDate>
      <description>&lt;p&gt;
Just to be completely silly, I thought I’d do a series of posts on CTP3 features themed
around Christmas. Hmm. That might read better as a series of Christmas posts themed
around CTP3. A very original idea I’m sure, but hey, those who know me will know that
I never pass up the opportunity to make a bad joke. So, without further adieu:
&lt;/p&gt;
&lt;p&gt;
On the first day of Christmas, &lt;a href="http://twitter.com/jsnover" target="_blank"&gt;Jeffrey&lt;/a&gt; gave
to me: 
&lt;/p&gt;
&lt;h3&gt;Nested Here-Strings
&lt;/h3&gt;
&lt;p&gt;
Here-Strings can now be embedded within each other to make it even easier to construct
literal documents! Delimit any nested code between $( and ) and then continue to use
a nested string within that as if it was completely stand alone. It just works! Cool,
eh?
&lt;/p&gt;
&lt;!-- Stylesheet link --&gt;
&lt;link href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css" type="text/css" rel="stylesheet"&gt;
&lt;!-- Code --&gt;
&lt;div class="dp-highlighter" id="hlDiv"&gt;
&lt;div class="bar"&gt;
&lt;/div&gt;
&lt;ol class="dp-rb"&gt;
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="keyword"&gt;function&lt;/span&gt;&lt;span&gt; Get-CommandDefinitionHtml {&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;# this tells powershell to allow
advanced features, &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;# like the [validatenotnullorempty()]
attribute below. &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [CmdletBinding()]&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;param&lt;/span&gt;&lt;span&gt;(&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ValidateNotNullOrEmpty()]&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [string]&lt;/span&gt;&lt;span class="variable"&gt;$name&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="variable"&gt;$command&lt;/span&gt;&lt;span&gt; = get-command &lt;/span&gt;&lt;span class="variable"&gt;$name&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;# Look mom! I'm a cmdlet! &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="variable"&gt;$PSCmdlet&lt;/span&gt;&lt;span&gt;.WriteVerbose(&lt;/span&gt;&lt;span class="string"&gt;"Dumping
HTML for "&lt;/span&gt;&lt;span&gt; + &lt;/span&gt;&lt;span class="variable"&gt;$command&lt;/span&gt;&lt;span&gt;)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;@&lt;/span&gt;&lt;span class="string"&gt;" &lt;/span&gt;&amp;nbsp;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;html&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;head&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;title&amp;gt;$($command.name)&amp;lt;/title&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/head&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;body&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;table border="&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span class="string"&gt;"&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;$( &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $command.parametersets | % { &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;@"&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;tr&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;td&amp;gt;$(&lt;/span&gt;&lt;span class="variable"&gt;$_&lt;/span&gt;&lt;span&gt;.name)&amp;lt;/td&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;td&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;table border=&lt;/span&gt;&lt;span class="string"&gt;"1"&lt;/span&gt;&lt;span&gt;&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;tr&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;th colspan=&lt;/span&gt;&lt;span class="string"&gt;"8"&lt;/span&gt;&lt;span&gt;&amp;gt;Parameters&amp;lt;/th&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;$(&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="variable"&gt;$count&lt;/span&gt;&lt;span&gt; =
0&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="variable"&gt;$_&lt;/span&gt;&lt;span&gt;.parameters
| % {&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; (0
-eq (&lt;/span&gt;&lt;span class="variable"&gt;$count&lt;/span&gt;&lt;span&gt; % 8)) {&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;@&lt;/span&gt;&lt;span class="string"&gt;" &lt;/span&gt;&amp;nbsp;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;/tr&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;tr&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;"&lt;/span&gt;&lt;span&gt;@&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;@&lt;/span&gt;&lt;span class="string"&gt;" &lt;/span&gt;&amp;nbsp;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;td&amp;gt;$($_.name)&amp;lt;/td&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;"&lt;/span&gt;&lt;span&gt;@&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="variable"&gt;$count&lt;/span&gt;&lt;span&gt;++&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;)&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;/tr&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;/table&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;/td&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="string"&gt;"@ &lt;/span&gt;&amp;nbsp;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;) &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;/table&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/body&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;span class="string"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/html&amp;gt; &lt;/span&gt;&amp;nbsp;&lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="string"&gt;"&lt;/span&gt;&lt;span&gt;@&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;}&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;Get-CommandDefinitionHtml get-item &amp;gt; out.html&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="comment"&gt;# show in browser &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;invoke-item out.html&amp;nbsp; &lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=3e82586b-d5c3-4e0d-883a-74e22919247c" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,3e82586b-d5c3-4e0d-883a-74e22919247c.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>CTP3</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=f18d408c-6381-446a-aa62-e5751a432ccb</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,f18d408c-6381-446a-aa62-e5751a432ccb.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,f18d408c-6381-446a-aa62-e5751a432ccb.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=f18d408c-6381-446a-aa62-e5751a432ccb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This time around, I thought I’d show how to work with programmatically generated dynamic
parameters, as opposed to the statically defined sets we saw the last time. The context
here is a fairly silly Cmdlet, but it’s good enough to demonstrate the concept end
to end. It’s a Cmdlet for removing a file. It takes one string parameter which is
the path to the file. The dynamic parameter I’m going to add is a –Force parameter.
The trick is, this parameter will only be added if the current user is an administrator
(XP), or is elevated as one (Vista). 
</p>
        <p>
This first portion of the Cmdlet defines the usual stuff like a verb and noun. This
time though, I’m using a regular class constructor. It’s not often you see constructors
in simple Cmdlets because typically all one would usually do is override one or more
of the three processing methods BeginProcessing, ProcessRecord and EndProcessing.
In this case, I need to create a instance of a “<a href="http://msdn.microsoft.com/en-us/library/system.management.automation.runtimedefinedparameterdictionary(VS.85).aspx" target="_blank">RuntimeDefinedParameterDictionary</a>,”
which does exactly what it says on the tin. It’s a dictionary of parameters, the key
being a string (the name of the parameter) and the value being a instance of a RuntimeDefinedParameter
class. These classes are all members of the System.Management.Automation namespace. 
</p>
        <p>
In the constructor, I’m calling a generic method defined as AddDynamicParameter&lt;T&gt;(string
name). This is only called if the current user is an admin. I’ve defined three generic
helper methods which you can see a little further down below.
</p>
        <!-- Stylesheet link -->
        <link href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css" type="text/css" rel="stylesheet" />
        <!-- Code -->
        <div class="dp-highlighter" id="hlDiv">
          <div class="bar">
          </div>
          <ol class="dp-c">
            <li class="alt">
              <span>
                <span>[Cmdlet(VerbsCommon.Remove, NOUN_FILE)]   </span>
              </span>
            </li>
            <li class="">
              <span>
              </span>
              <span class="keyword">public</span>
              <span> </span>
              <span class="keyword">class</span>
              <span> RemoveFileCommand
: PSCmdlet, IDynamicParameters   </span>
            </li>
            <li class="alt">
              <span>{   </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="keyword">private</span>
              <span> </span>
              <span class="keyword">const</span>
              <span> </span>
              <span class="keyword">string</span>
              <span> NOUN_FILE     
= </span>
              <span class="string">"File"</span>
              <span>;   </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">private</span>
              <span> </span>
              <span class="keyword">const</span>
              <span> </span>
              <span class="keyword">string</span>
              <span> SWITCH_FORCE  
= </span>
              <span class="string">"Force"</span>
              <span>;   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">private</span>
              <span> </span>
              <span class="keyword">readonly</span>
              <span> RuntimeDefinedParameterDictionary
_parameters;   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">public</span>
              <span> RemoveFileCommand()   </span>
            </li>
            <li class="">
              <span>    {   </span>
            </li>
            <li class="alt">
              <span>        _parameters = </span>
              <span class="keyword">new</span>
              <span> RuntimeDefinedParameterDictionary();   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="comment">// we
only want to add the -Force parameter if </span>
              <span>  </span>
            </li>
            <li class="">
              <span>        </span>
              <span class="comment">// the
current user is an administrator </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>        var principal = </span>
              <span class="keyword">new</span>
              <span> WindowsPrincipal(WindowsIdentity.GetCurrent());   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="comment">// if
vista and not elevated, this will be false even </span>
              <span>  </span>
            </li>
            <li class="">
              <span>        </span>
              <span class="comment">// if
you are a member of administrators. </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="keyword">if</span>
              <span> (principal.IsInRole(WindowsBuiltInRole.Administrator))   </span>
            </li>
            <li class="">
              <span>        {   </span>
            </li>
            <li class="alt">
              <span>            </span>
              <span class="keyword">this</span>
              <span>.AddDynamicParameter&lt;SwitchParameter&gt;(SWITCH_FORCE);   </span>
            </li>
            <li class="">
              <span>        }   </span>
            </li>
            <li class="alt">
              <span>    }   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>    [Parameter]   </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="keyword">public</span>
              <span> </span>
              <span class="keyword">string</span>
              <span> FilePath   </span>
            </li>
            <li class="alt">
              <span>    {   </span>
            </li>
            <li class="">
              <span>        </span>
              <span class="keyword">get</span>
              <span>;   </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="keyword">set</span>
              <span>;   </span>
            </li>
            <li class="">
              <span>    }    </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="keyword">protected</span>
              <span> </span>
              <span class="keyword">override</span>
              <span> </span>
              <span class="keyword">void</span>
              <span> EndProcessing()   </span>
            </li>
            <li class="alt">
              <span>    {   </span>
            </li>
            <li class="">
              <span>        </span>
              <span class="comment">// does
file exist? </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="keyword">if</span>
              <span> (File.Exists(FilePath))   </span>
            </li>
            <li class="">
              <span>        {   </span>
            </li>
            <li class="alt">
              <span>            RemoveFile();   </span>
            </li>
            <li class="">
              <span>        }   </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="keyword">else</span>
              <span>  </span>
            </li>
            <li class="">
              <span>        {   </span>
            </li>
            <li class="alt">
              <span>            WriteWarning(FilePath
+ </span>
              <span class="string">" does not exist."</span>
              <span>);   </span>
            </li>
            <li class="">
              <span>        }   </span>
            </li>
            <li class="alt">
              <span>    }  </span>
            </li>
          </ol>
        </div>
        <p>
This is a simple piece of code who’s role is to remove the file specified by the user.
I’ve omitted the actual code that would delete the file for brevity. I’m using another
helper method to see if the –Force parameter has been added to the Cmdlet’s definition,
and if so, was it specified by the invoker of the Cmdlet. The idea is here is that
the Cmdlet will not remove the file if it’s marked Read-Only, but if –Force is specified
it <em>will</em> remove the R/O attribute and continue as planned. 
</p>
        <div class="dp-highlighter" id="hlDiv">
          <div class="bar">
          </div>
          <ol class="dp-c">
            <li class="alt">
              <span>
                <span class="keyword">private</span>
                <span> </span>
                <span class="keyword">void</span>
                <span> RemoveFile()   </span>
              </span>
            </li>
            <li class="">
              <span>{   </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="comment">// read file attributes </span>
              <span>  </span>
            </li>
            <li class="">
              <span>    var attribs = File.GetAttributes(FilePath);   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="comment">// is read-only attribute set? </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">if</span>
              <span> ((attribs &amp;
FileAttributes.ReadOnly) == FileAttributes.ReadOnly)   </span>
            </li>
            <li class="">
              <span>    {   </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="keyword">bool</span>
              <span> shouldForce;   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="comment">// see
if the dynamic switch -Force was added (and specified) </span>
              <span>  </span>
            </li>
            <li class="">
              <span>        </span>
              <span class="keyword">if</span>
              <span> (TryGetSwitchParameter(SWITCH_FORCE, </span>
              <span class="keyword">out</span>
              <span> shouldForce))   </span>
            </li>
            <li class="alt">
              <span>        {   </span>
            </li>
            <li class="">
              <span>            WriteVerbose(</span>
              <span class="string">"Force.IsPresent:
"</span>
              <span> + shouldForce);   </span>
            </li>
            <li class="alt">
              <span>        }   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="keyword">if</span>
              <span> (shouldForce)   </span>
            </li>
            <li class="">
              <span>        {   </span>
            </li>
            <li class="alt">
              <span>            RemoveReadOnlyAttribute();   </span>
            </li>
            <li class="">
              <span>        }   </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="keyword">else</span>
              <span>  </span>
            </li>
            <li class="">
              <span>        {   </span>
            </li>
            <li class="alt">
              <span>            WriteWarning(FilePath
+ </span>
              <span class="string">" is marked Read-Only!"</span>
              <span>);   </span>
            </li>
            <li class="">
              <span>            </span>
              <span class="keyword">return</span>
              <span>;   </span>
            </li>
            <li class="alt">
              <span>        }   </span>
            </li>
            <li class="">
              <span>    }   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="comment">// ... code to remove file ... </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>}  </span>
            </li>
          </ol>
        </div>
        <p>
And the final piece is here. The first method GetDynamicParameters, belongs to the
IDynamicParameters interface and tells PowerShell that the Cmdlet may return extra
parameters not defined on the class itself. In this case, we are returning a RuntimeDefinedParameterDictionary
instead of a <a href="http://www.nivot.org/2008/12/02/Quickstart2DynamicParameters1Of3StaticallyDefinedParameters.aspx" target="_blank">statically
defined parameters on a nested class</a>. 
</p>
        <div class="dp-highlighter" id="hlDiv">
          <div class="bar">
          </div>
          <ol class="dp-c">
            <li class="alt">
              <span>
                <span class="keyword">public</span>
                <span> </span>
                <span class="keyword">object</span>
                <span> GetDynamicParameters()   </span>
              </span>
            </li>
            <li class="">
              <span>{   </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">return</span>
              <span> _parameters;   </span>
            </li>
            <li class="">
              <span>}   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>
              </span>
              <span class="comment">// add a simple parameter of type T to this cmdlet </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>
              </span>
              <span class="keyword">private</span>
              <span> </span>
              <span class="keyword">void</span>
              <span> AddDynamicParameter&lt;T&gt;(</span>
              <span class="keyword">string</span>
              <span> name)   </span>
            </li>
            <li class="">
              <span>{   </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="comment">// create a parameter of type
T. </span>
              <span>  </span>
            </li>
            <li class="">
              <span>    var parameter = </span>
              <span class="keyword">new</span>
              <span> RuntimeDefinedParameter   </span>
            </li>
            <li class="alt">
              <span>                   
{   </span>
            </li>
            <li class="">
              <span>                       
Name = name,   </span>
            </li>
            <li class="alt">
              <span>                       
ParameterType = </span>
              <span class="keyword">typeof</span>
              <span> (T),                                   </span>
            </li>
            <li class="">
              <span>                   
};   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="comment">// add the [parameter] attribute </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>    var attrib = </span>
              <span class="keyword">new</span>
              <span> ParameterAttribute   </span>
            </li>
            <li class="">
              <span>                
{                                </span>
            </li>
            <li class="alt">
              <span>                    
ParameterSetName =   </span>
            </li>
            <li class="">
              <span>                       
ParameterAttribute.AllParameterSets   </span>
            </li>
            <li class="alt">
              <span>                
};   </span>
            </li>
            <li class="">
              <span>       </span>
            </li>
            <li class="alt">
              <span>    parameter.Attributes.Add(attrib);   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>    _parameters.Add(name, parameter);   </span>
            </li>
            <li class="">
              <span>}   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>
              </span>
              <span class="keyword">private</span>
              <span> </span>
              <span class="keyword">bool</span>
              <span> TryGetSwitchParameter(</span>
              <span class="keyword">string</span>
              <span> name, </span>
              <span class="keyword">out</span>
              <span> </span>
              <span class="keyword">bool</span>
              <span> isPresent)   </span>
            </li>
            <li class="alt">
              <span>{   </span>
            </li>
            <li class="">
              <span>    RuntimeDefinedParameter parameter;   </span>
            </li>
            <li class="alt">
              <span>       </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="keyword">if</span>
              <span> (TryGetDynamicParameter(name, </span>
              <span class="keyword">out</span>
              <span> parameter))   </span>
            </li>
            <li class="alt">
              <span>    {   </span>
            </li>
            <li class="">
              <span>        isPresent = parameter.IsSet;   </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="keyword">return</span>
              <span> </span>
              <span class="keyword">true</span>
              <span>;   </span>
            </li>
            <li class="">
              <span>    }   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>    isPresent = </span>
              <span class="keyword">false</span>
              <span>;   </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">return</span>
              <span> </span>
              <span class="keyword">false</span>
              <span>;   </span>
            </li>
            <li class="">
              <span>}   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>
              </span>
              <span class="comment">// get a parameter of type T. </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>
              </span>
              <span class="keyword">private</span>
              <span> </span>
              <span class="keyword">bool</span>
              <span> TryGetParameter&lt;T&gt;(</span>
              <span class="keyword">string</span>
              <span> name, </span>
              <span class="keyword">out</span>
              <span> T
value)   </span>
            </li>
            <li class="">
              <span>{   </span>
            </li>
            <li class="alt">
              <span>    RuntimeDefinedParameter parameter;   </span>
            </li>
            <li class="">
              <span>       </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">if</span>
              <span> (TryGetDynamicParameter(name, </span>
              <span class="keyword">out</span>
              <span> parameter))   </span>
            </li>
            <li class="">
              <span>    {   </span>
            </li>
            <li class="alt">
              <span>        value = (T)parameter.Value;   </span>
            </li>
            <li class="">
              <span>        </span>
              <span class="keyword">return</span>
              <span> </span>
              <span class="keyword">true</span>
              <span>;   </span>
            </li>
            <li class="alt">
              <span>    }   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>    value = </span>
              <span class="keyword">default</span>
              <span>(T);   </span>
            </li>
            <li class="">
              <span>       </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">return</span>
              <span> </span>
              <span class="keyword">false</span>
              <span>;   </span>
            </li>
            <li class="">
              <span>}   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>
              </span>
              <span class="comment">// try to get a dynamically added parameter </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>
              </span>
              <span class="keyword">private</span>
              <span> </span>
              <span class="keyword">bool</span>
              <span> TryGetDynamicParameter(</span>
              <span class="keyword">string</span>
              <span> name, </span>
              <span class="keyword">out</span>
              <span> RuntimeDefinedParameter
value)   </span>
            </li>
            <li class="">
              <span>{   </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">if</span>
              <span> (_parameters.ContainsKey(name))   </span>
            </li>
            <li class="">
              <span>    {   </span>
            </li>
            <li class="alt">
              <span>        value = _parameters[name];   </span>
            </li>
            <li class="">
              <span>        </span>
              <span class="keyword">return</span>
              <span> </span>
              <span class="keyword">true</span>
              <span>;   </span>
            </li>
            <li class="alt">
              <span>    }   </span>
            </li>
            <li class="">
              <span>  </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="comment">// need to set this before leaving
the method </span>
              <span>  </span>
            </li>
            <li class="">
              <span>    value = </span>
              <span class="keyword">null</span>
              <span>;   </span>
            </li>
            <li class="alt">
              <span>  </span>
            </li>
            <li class="">
              <span>    </span>
              <span class="keyword">return</span>
              <span> </span>
              <span class="keyword">false</span>
              <span>;   </span>
            </li>
            <li class="alt">
              <span>}   </span>
            </li>
          </ol>
        </div>
        <p>
Finally, the three helper methods are revealed. One is used for checking for dynamic
SwitchParameters, the next is for ordinary parameters that return type T, the generic
argument. The third method, TryGetDynamicParameter is used by the first two methods. 
</p>
        <p>
I hope this helps reveal some of the mystery behind dynamic parameters on Cmdlets.
There is one more type of dynamic parameter that I will be examining in one of my
next few posts, that is the scenario where a provider (like the FileSystemProvider
or RegistryProvider) passes a dynamic parameter to a Cmdlet. In this particular case,
the provider can only pass dynamic parameters to the built-in Cmdlets that operate
on providers, e.g. Get-ChildItem, Get-Item, Get-ItemProperty etc.
</p>
        <p>
Have fun!
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=f18d408c-6381-446a-aa62-e5751a432ccb" />
      </body>
      <title>Quickstart #3: Dynamic Parameters 2 of 3 – Runtime Defined Parameters</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,f18d408c-6381-446a-aa62-e5751a432ccb.aspx</guid>
      <link>http://www.nivot.org/2008/12/21/Quickstart3DynamicParameters2Of3RuntimeDefinedParameters.aspx</link>
      <pubDate>Sun, 21 Dec 2008 22:28:27 GMT</pubDate>
      <description>&lt;p&gt;
This time around, I thought I’d show how to work with programmatically generated dynamic
parameters, as opposed to the statically defined sets we saw the last time. The context
here is a fairly silly Cmdlet, but it’s good enough to demonstrate the concept end
to end. It’s a Cmdlet for removing a file. It takes one string parameter which is
the path to the file. The dynamic parameter I’m going to add is a –Force parameter.
The trick is, this parameter will only be added if the current user is an administrator
(XP), or is elevated as one (Vista). 
&lt;/p&gt;
&lt;p&gt;
This first portion of the Cmdlet defines the usual stuff like a verb and noun. This
time though, I’m using a regular class constructor. It’s not often you see constructors
in simple Cmdlets because typically all one would usually do is override one or more
of the three processing methods BeginProcessing, ProcessRecord and EndProcessing.
In this case, I need to create a instance of a “&lt;a href="http://msdn.microsoft.com/en-us/library/system.management.automation.runtimedefinedparameterdictionary(VS.85).aspx" target="_blank"&gt;RuntimeDefinedParameterDictionary&lt;/a&gt;,”
which does exactly what it says on the tin. It’s a dictionary of parameters, the key
being a string (the name of the parameter) and the value being a instance of a RuntimeDefinedParameter
class. These classes are all members of the System.Management.Automation namespace. 
&lt;/p&gt;
&lt;p&gt;
In the constructor, I’m calling a generic method defined as AddDynamicParameter&amp;lt;T&amp;gt;(string
name). This is only called if the current user is an admin. I’ve defined three generic
helper methods which you can see a little further down below.
&lt;/p&gt;
&lt;!-- Stylesheet link --&gt;
&lt;link href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css" type="text/css" rel="stylesheet"&gt;
&lt;!-- Code --&gt;
&lt;div class="dp-highlighter" id="hlDiv"&gt;
&lt;div class="bar"&gt;
&lt;/div&gt;
&lt;ol class="dp-c"&gt;
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span&gt;[Cmdlet(VerbsCommon.Remove, NOUN_FILE)]&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;class&lt;/span&gt;&lt;span&gt; RemoveFileCommand
: PSCmdlet, IDynamicParameters&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;{&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;const&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;string&lt;/span&gt;&lt;span&gt; NOUN_FILE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
= &lt;/span&gt;&lt;span class="string"&gt;"File"&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;const&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;string&lt;/span&gt;&lt;span&gt; SWITCH_FORCE&amp;nbsp;&amp;nbsp;
= &lt;/span&gt;&lt;span class="string"&gt;"Force"&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;readonly&lt;/span&gt;&lt;span&gt; RuntimeDefinedParameterDictionary
_parameters;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span&gt; RemoveFileCommand()&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _parameters = &lt;/span&gt;&lt;span class="keyword"&gt;new&lt;/span&gt;&lt;span&gt; RuntimeDefinedParameterDictionary();&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// we
only want to add the -Force parameter if &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// the
current user is an administrator &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var principal = &lt;/span&gt;&lt;span class="keyword"&gt;new&lt;/span&gt;&lt;span&gt; WindowsPrincipal(WindowsIdentity.GetCurrent());&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// if
vista and not elevated, this will be false even &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// if
you are a member of administrators. &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; (principal.IsInRole(WindowsBuiltInRole.Administrator))&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;this&lt;/span&gt;&lt;span&gt;.AddDynamicParameter&amp;lt;SwitchParameter&amp;gt;(SWITCH_FORCE);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Parameter]&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;string&lt;/span&gt;&lt;span&gt; FilePath&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;get&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;set&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;protected&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;override&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;void&lt;/span&gt;&lt;span&gt; EndProcessing()&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// does
file exist? &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; (File.Exists(FilePath))&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RemoveFile();&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;else&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WriteWarning(FilePath
+ &lt;/span&gt;&lt;span class="string"&gt;" does not exist."&lt;/span&gt;&lt;span&gt;);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
This is a simple piece of code who’s role is to remove the file specified by the user.
I’ve omitted the actual code that would delete the file for brevity. I’m using another
helper method to see if the –Force parameter has been added to the Cmdlet’s definition,
and if so, was it specified by the invoker of the Cmdlet. The idea is here is that
the Cmdlet will not remove the file if it’s marked Read-Only, but if –Force is specified
it &lt;em&gt;will&lt;/em&gt; remove the R/O attribute and continue as planned. 
&lt;/p&gt;
&lt;div class="dp-highlighter" id="hlDiv"&gt;
&lt;div class="bar"&gt;
&lt;/div&gt;
&lt;ol class="dp-c"&gt;
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;void&lt;/span&gt;&lt;span&gt; RemoveFile()&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;{&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// read file attributes &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var attribs = File.GetAttributes(FilePath);&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// is read-only attribute set? &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; ((attribs &amp;amp;
FileAttributes.ReadOnly) == FileAttributes.ReadOnly)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;bool&lt;/span&gt;&lt;span&gt; shouldForce;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// see
if the dynamic switch -Force was added (and specified) &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; (TryGetSwitchParameter(SWITCH_FORCE, &lt;/span&gt;&lt;span class="keyword"&gt;out&lt;/span&gt;&lt;span&gt; shouldForce))&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WriteVerbose(&lt;/span&gt;&lt;span class="string"&gt;"Force.IsPresent:
"&lt;/span&gt;&lt;span&gt; + shouldForce);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; (shouldForce)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RemoveReadOnlyAttribute();&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;else&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WriteWarning(FilePath
+ &lt;/span&gt;&lt;span class="string"&gt;" is marked Read-Only!"&lt;/span&gt;&lt;span&gt;);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// ... code to remove file ... &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;}&amp;nbsp; &lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
And the final piece is here. The first method GetDynamicParameters, belongs to the
IDynamicParameters interface and tells PowerShell that the Cmdlet may return extra
parameters not defined on the class itself. In this case, we are returning a RuntimeDefinedParameterDictionary
instead of a &lt;a href="http://www.nivot.org/2008/12/02/Quickstart2DynamicParameters1Of3StaticallyDefinedParameters.aspx" target="_blank"&gt;statically
defined parameters on a nested class&lt;/a&gt;. 
&lt;/p&gt;
&lt;div class="dp-highlighter" id="hlDiv"&gt;
&lt;div class="bar"&gt;
&lt;/div&gt;
&lt;ol class="dp-c"&gt;
&lt;li class="alt"&gt;
&lt;span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;object&lt;/span&gt;&lt;span&gt; GetDynamicParameters()&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;{&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span&gt; _parameters;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;}&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="comment"&gt;// add a simple parameter of type T to this cmdlet &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;void&lt;/span&gt;&lt;span&gt; AddDynamicParameter&amp;lt;T&amp;gt;(&lt;/span&gt;&lt;span class="keyword"&gt;string&lt;/span&gt;&lt;span&gt; name)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;{&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// create a parameter of type
T. &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var parameter = &lt;/span&gt;&lt;span class="keyword"&gt;new&lt;/span&gt;&lt;span&gt; RuntimeDefinedParameter&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
Name = name,&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
ParameterType = &lt;/span&gt;&lt;span class="keyword"&gt;typeof&lt;/span&gt;&lt;span&gt; (T),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
};&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// add the [parameter] attribute &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var attrib = &lt;/span&gt;&lt;span class="keyword"&gt;new&lt;/span&gt;&lt;span&gt; ParameterAttribute&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
ParameterSetName =&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
ParameterAttribute.AllParameterSets&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
};&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameter.Attributes.Add(attrib);&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _parameters.Add(name, parameter);&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;}&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;bool&lt;/span&gt;&lt;span&gt; TryGetSwitchParameter(&lt;/span&gt;&lt;span class="keyword"&gt;string&lt;/span&gt;&lt;span&gt; name, &lt;/span&gt;&lt;span class="keyword"&gt;out&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;bool&lt;/span&gt;&lt;span&gt; isPresent)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;{&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RuntimeDefinedParameter parameter;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; (TryGetDynamicParameter(name, &lt;/span&gt;&lt;span class="keyword"&gt;out&lt;/span&gt;&lt;span&gt; parameter))&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; isPresent = parameter.IsSet;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;true&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; isPresent = &lt;/span&gt;&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;}&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="comment"&gt;// get a parameter of type T. &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;bool&lt;/span&gt;&lt;span&gt; TryGetParameter&amp;lt;T&amp;gt;(&lt;/span&gt;&lt;span class="keyword"&gt;string&lt;/span&gt;&lt;span&gt; name, &lt;/span&gt;&lt;span class="keyword"&gt;out&lt;/span&gt;&lt;span&gt; T
value)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;{&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RuntimeDefinedParameter parameter;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; (TryGetDynamicParameter(name, &lt;/span&gt;&lt;span class="keyword"&gt;out&lt;/span&gt;&lt;span&gt; parameter))&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = (T)parameter.Value;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;true&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = &lt;/span&gt;&lt;span class="keyword"&gt;default&lt;/span&gt;&lt;span&gt;(T);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;}&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="comment"&gt;// try to get a dynamically added parameter &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;bool&lt;/span&gt;&lt;span&gt; TryGetDynamicParameter(&lt;/span&gt;&lt;span class="keyword"&gt;string&lt;/span&gt;&lt;span&gt; name, &lt;/span&gt;&lt;span class="keyword"&gt;out&lt;/span&gt;&lt;span&gt; RuntimeDefinedParameter
value)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;{&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span&gt; (_parameters.ContainsKey(name))&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = _parameters[name];&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;true&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="comment"&gt;// need to set this before leaving
the method &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = &lt;/span&gt;&lt;span class="keyword"&gt;null&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;&amp;nbsp; &lt;/span&gt; 
&lt;li class=""&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="keyword"&gt;false&lt;/span&gt;&lt;span&gt;;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class="alt"&gt;
&lt;span&gt;}&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
Finally, the three helper methods are revealed. One is used for checking for dynamic
SwitchParameters, the next is for ordinary parameters that return type T, the generic
argument. The third method, TryGetDynamicParameter is used by the first two methods. 
&lt;/p&gt;
&lt;p&gt;
I hope this helps reveal some of the mystery behind dynamic parameters on Cmdlets.
There is one more type of dynamic parameter that I will be examining in one of my
next few posts, that is the scenario where a provider (like the FileSystemProvider
or RegistryProvider) passes a dynamic parameter to a Cmdlet. In this particular case,
the provider can only pass dynamic parameters to the built-in Cmdlets that operate
on providers, e.g. Get-ChildItem, Get-Item, Get-ItemProperty etc.
&lt;/p&gt;
&lt;p&gt;
Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=f18d408c-6381-446a-aa62-e5751a432ccb" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,f18d408c-6381-446a-aa62-e5751a432ccb.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>Providers</category>
      <category>SnapIns</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=ff314040-e2e2-4237-bde6-15e8969c0a99</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,ff314040-e2e2-4237-bde6-15e8969c0a99.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,ff314040-e2e2-4237-bde6-15e8969c0a99.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=ff314040-e2e2-4237-bde6-15e8969c0a99</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It seems lots of people are catching the <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a> bug
these days. People who previously considered themselves as administrators have learned
enough of the magic from using PowerShell from day to day over the last few months
that they feel comfortable enough to tinker around with C#. 
</p>
        <p>
This is an example Cmdlet skeleton that is designed to work with Files and Directories.
It looks after resolving wildcards, supports –WhatIf and –Confirm, accepting files
and/or directories from the pipeline or accepting strings of paths from the pipeine.
It also ensures that the only types of paths it can accept lie on the File System.
Here’s an example of the invocation styles it supports:
</p>
        <p>
          <a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Quickstart1ACmdletThatProcessesFilesandD_FCDC/cmdlet_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="cmdlet" border="0" alt="cmdlet" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Quickstart1ACmdletThatProcessesFilesandD_FCDC/cmdlet_thumb.png" width="537" height="480" />
          </a>
        </p>
        <p>
Here’s the source code for this. It doesn’t really do a lot. It spits out two different
types of custom objects: one for a file, and another for a directory. Feel free to
do what you like with it; it’s yours. Have fun.
</p>
        <pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">using</span> System; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">using</span> System.Collections.Generic; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">using</span> System.IO; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">using</span> System.Management.Automation; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">using</span> Microsoft.PowerShell.Commands; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">namespace</span> PSQuickStart </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">{
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    [Cmdlet(VerbsCommon.Get, Noun,
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        DefaultParameterSetName = ParmamSetPath,
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        SupportsShouldProcess = <span style="color: #0000ff">true</span>) </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    ]
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">public</span>
            <span style="color: #0000ff">class</span> GetFileMetadataCommand
: PSCmdlet </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    {
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">private</span>
            <span style="color: #0000ff">const</span>
            <span style="color: #0000ff">string</span> Noun
= "<span style="color: #8b0000">FileMetadata</span>"; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">private</span>
            <span style="color: #0000ff">const</span>
            <span style="color: #0000ff">string</span> ParamSetLiteral
= "<span style="color: #8b0000">Literal</span>"; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">private</span>
            <span style="color: #0000ff">const</span>
            <span style="color: #0000ff">string</span> ParmamSetPath
= "<span style="color: #8b0000">Path</span>"; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">private</span>
            <span style="color: #0000ff">string</span>[]
_paths; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">private</span>
            <span style="color: #0000ff">bool</span> _shouldExpandWildcards; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        [Parameter(
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            Position = 0,
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            Mandatory = <span style="color: #0000ff">true</span>, </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            ValueFromPipeline = <span style="color: #0000ff">false</span>, </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            ValueFromPipelineByPropertyName = <span style="color: #0000ff">true</span>, </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            ParameterSetName = ParamSetLiteral)
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        ]
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        [Alias("<span style="color: #8b0000">PSPath</span>")] </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        [ValidateNotNullOrEmpty]
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">public</span>
            <span style="color: #0000ff">string</span>[]
LiteralPath </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        {
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">get</span> { <span style="color: #0000ff">return</span> _paths;
} </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">set</span> {
_paths = <span style="color: #0000ff">value</span>; } </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        [Parameter(
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            Position = 0,
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            Mandatory = <span style="color: #0000ff">true</span>, </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            ValueFromPipeline = <span style="color: #0000ff">true</span>, </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            ValueFromPipelineByPropertyName = <span style="color: #0000ff">true</span>, </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            ParameterSetName = ParmamSetPath)
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        ]
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        [ValidateNotNullOrEmpty]
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">public</span>
            <span style="color: #0000ff">string</span>[]
Path </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        {
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">get</span> { <span style="color: #0000ff">return</span> _paths;
} </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">set</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                _shouldExpandWildcards = <span style="color: #0000ff">true</span>; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                _paths = <span style="color: #0000ff">value</span>; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            }
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">protected</span>
            <span style="color: #0000ff">override</span>
            <span style="color: #0000ff">void</span> ProcessRecord() </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        {
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">foreach</span> (<span style="color: #0000ff">string</span> path <span style="color: #0000ff">in</span> _paths) </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            {
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
This will hold information about the provider containing</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
the items that this path string might resolve to. </span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                ProviderInfo provider;
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
This will be used by the method that processes literal paths</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                PSDriveInfo drive;
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
this contains the paths to process for this iteration of the</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
loop to resolve and optionally expand wildcards.</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                List&lt;<span style="color: #0000ff">string</span>&gt;
filePaths = <span style="color: #0000ff">new</span> List&lt;<span style="color: #0000ff">string</span>&gt;(); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">if</span> (_shouldExpandWildcards) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
Turn *.txt into foo.txt,foo2.txt etc.</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
if path is just "foo.txt," it will return unchanged.</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                    filePaths.AddRange(<span style="color: #0000ff">this</span>.GetResolvedProviderPathFromPSPath(path, <span style="color: #0000ff">out</span> provider)); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">else</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
no wildcards, so don't try to expand any * or ? symbols. </span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                    filePaths.Add(<span style="color: #0000ff">this</span>.SessionState.Path.GetUnresolvedProviderPathFromPSPath( </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                        path, <span style="color: #0000ff">out</span> provider, <span style="color: #0000ff">out</span> drive)); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
ensure that this path (or set of paths after wildcard expansion)</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
is on the filesystem. A wildcard can never expand to span multiple</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
providers.</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">if</span> (IsFileSystemPath(provider,
path) == <span style="color: #0000ff">false</span>) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
no, so skip to next path in _paths.</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">continue</span>; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                }
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
at this point, we have a list of paths on the filesystem.</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">foreach</span> (<span style="color: #0000ff">string</span> filePath <span style="color: #0000ff">in</span> filePaths) </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                {
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                    PSObject custom;
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
If -whatif was supplied, do not perform the actions</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
inside this "if" statement; only show the message.</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
This block also supports the -confirm switch, where</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
you will be asked if you want to perform the action</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
"get metadata" on target: foo.txt</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">if</span> (ShouldProcess(filePath,
"<span style="color: #8b0000">Get Metadata</span>")) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                    {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">if</span> (Directory.Exists(filePath)) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                        {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                            custom = GetDirectoryCustomObject(<span style="color: #0000ff">new</span> DirectoryInfo(filePath)); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                        }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">else</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                        {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                            custom = GetFileCustomObject(<span style="color: #0000ff">new</span> FileInfo(filePath)); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                        }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                        WriteObject(custom);
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                    }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                }
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        }
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">private</span> PSObject
GetFileCustomObject(FileInfo file) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
this message will be shown if the -verbose switch is given</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            WriteVerbose("<span style="color: #8b0000">GetFileCustomObject </span>"
+ file); </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
create a custom object with a few properties</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            PSObject custom = <span style="color: #0000ff">new</span> PSObject(); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            custom.Properties.Add(<span style="color: #0000ff">new</span> PSNoteProperty("<span style="color: #8b0000">Size</span>",
file.Length)); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            custom.Properties.Add(<span style="color: #0000ff">new</span> PSNoteProperty("<span style="color: #8b0000">Name</span>",
file.Name)); </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            custom.Properties.Add(<span style="color: #0000ff">new</span> PSNoteProperty("<span style="color: #8b0000">Extension</span>",
file.Extension)); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">return</span> custom; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">private</span> PSObject
GetDirectoryCustomObject(DirectoryInfo dir) </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        {
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
this message will be shown if the -verbose switch is given</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            WriteVerbose("<span style="color: #8b0000">GetDirectoryCustomObject </span>"
+ dir); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
create a custom object with a few properties</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            PSObject custom = <span style="color: #0000ff">new</span> PSObject(); </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">int</span> files
= dir.GetFiles().Length; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">int</span> subdirs
= dir.GetDirectories().Length; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            custom.Properties.Add(<span style="color: #0000ff">new</span> PSNoteProperty("<span style="color: #8b0000">Files</span>",
files)); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            custom.Properties.Add(<span style="color: #0000ff">new</span> PSNoteProperty("<span style="color: #8b0000">Subdirectories</span>",
subdirs)); </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            custom.Properties.Add(<span style="color: #0000ff">new</span> PSNoteProperty("<span style="color: #8b0000">Name</span>",
dir.Name)); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">return</span> custom; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">private</span>
            <span style="color: #0000ff">bool</span> IsFileSystemPath(ProviderInfo
provider, <span style="color: #0000ff">string</span> path) </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        {
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">bool</span> isFileSystem
= <span style="color: #0000ff">true</span>; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
check that this provider is the filesystem</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">if</span> (provider.ImplementingType
!= <span style="color: #0000ff">typeof</span>(FileSystemProvider)) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
create a .NET exception wrapping our error text</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                ArgumentException ex = <span style="color: #0000ff">new</span> ArgumentException(path
+ </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                    "<span style="color: #8b0000"> does
not resolve to a path on the FileSystem provider.</span>"); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
wrap this in a powershell errorrecord</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                ErrorRecord error = <span style="color: #0000ff">new</span> ErrorRecord(ex,
"<span style="color: #8b0000">InvalidProvider</span>", </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                    ErrorCategory.InvalidArgument, path);
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
write a non-terminating error to pipeline</span>
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">this</span>.WriteError(error); </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #008000">//
tell our caller that the item was not on the filesystem</span>
          </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">                isFileSystem = <span style="color: #0000ff">false</span>; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">            }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
            <span style="color: #0000ff">return</span> isFileSystem; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        }
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">}
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
          </pre>
        </pre>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=ff314040-e2e2-4237-bde6-15e8969c0a99" />
      </body>
      <title>Quickstart #1 - A Cmdlet That Processes Files and Directories</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,ff314040-e2e2-4237-bde6-15e8969c0a99.aspx</guid>
      <link>http://www.nivot.org/2008/11/19/Quickstart1ACmdletThatProcessesFilesAndDirectories.aspx</link>
      <pubDate>Wed, 19 Nov 2008 22:58:18 GMT</pubDate>
      <description>&lt;p&gt;
It seems lots of people are catching the &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;PowerShell&lt;/a&gt; bug
these days. People who previously considered themselves as administrators have learned
enough of the magic from using PowerShell from day to day over the last few months
that they feel comfortable enough to tinker around with C#. 
&lt;/p&gt;
&lt;p&gt;
This is an example Cmdlet skeleton that is designed to work with Files and Directories.
It looks after resolving wildcards, supports –WhatIf and –Confirm, accepting files
and/or directories from the pipeline or accepting strings of paths from the pipeine.
It also ensures that the only types of paths it can accept lie on the File System.
Here’s an example of the invocation styles it supports:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.nivot.org/content/binary/WindowsLiveWriter/Quickstart1ACmdletThatProcessesFilesandD_FCDC/cmdlet_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="cmdlet" border="0" alt="cmdlet" src="http://www.nivot.org/content/binary/WindowsLiveWriter/Quickstart1ACmdletThatProcessesFilesandD_FCDC/cmdlet_thumb.png" width="537" height="480"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Here’s the source code for this. It doesn’t really do a lot. It spits out two different
types of custom objects: one for a file, and another for a directory. Feel free to
do what you like with it; it’s yours. Have fun.
&lt;/p&gt;
&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.IO; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Management.Automation; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.PowerShell.Commands; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; PSQuickStart &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    [Cmdlet(VerbsCommon.Get, Noun,
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        DefaultParameterSetName = ParmamSetPath,
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        SupportsShouldProcess = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;) &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    ]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; GetFileMetadataCommand
: PSCmdlet &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;const&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Noun
= "&lt;span style="color: #8b0000"&gt;FileMetadata&lt;/span&gt;"; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;const&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; ParamSetLiteral
= "&lt;span style="color: #8b0000"&gt;Literal&lt;/span&gt;"; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;const&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; ParmamSetPath
= "&lt;span style="color: #8b0000"&gt;Path&lt;/span&gt;"; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[]
_paths; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; _shouldExpandWildcards; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [Parameter(
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            Position = 0,
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            Mandatory = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;, &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            ValueFromPipeline = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;, &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            ValueFromPipelineByPropertyName = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;, &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            ParameterSetName = ParamSetLiteral)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        ]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [Alias("&lt;span style="color: #8b0000"&gt;PSPath&lt;/span&gt;")] &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [ValidateNotNullOrEmpty]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[]
LiteralPath &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;get&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _paths;
} &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;set&lt;/span&gt; {
_paths = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;; } &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [Parameter(
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            Position = 0,
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            Mandatory = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;, &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            ValueFromPipeline = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;, &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            ValueFromPipelineByPropertyName = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;, &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            ParameterSetName = ParmamSetPath)
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        ]
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [ValidateNotNullOrEmpty]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[]
Path &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;get&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _paths;
} &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;set&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                _shouldExpandWildcards = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                _paths = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ProcessRecord() &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; path &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; _paths) &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
This will hold information about the provider containing&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
the items that this path string might resolve to. &lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                ProviderInfo provider;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
This will be used by the method that processes literal paths&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                PSDriveInfo drive;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
this contains the paths to process for this iteration of the&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
loop to resolve and optionally expand wildcards.&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;
filePaths = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;(); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (_shouldExpandWildcards) &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
Turn *.txt into foo.txt,foo2.txt etc.&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
if path is just "foo.txt," it will return unchanged.&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    filePaths.AddRange(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GetResolvedProviderPathFromPSPath(path, &lt;span style="color: #0000ff"&gt;out&lt;/span&gt; provider)); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
no wildcards, so don't try to expand any * or ? symbols. &lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    filePaths.Add(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.SessionState.Path.GetUnresolvedProviderPathFromPSPath( &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        path, &lt;span style="color: #0000ff"&gt;out&lt;/span&gt; provider, &lt;span style="color: #0000ff"&gt;out&lt;/span&gt; drive)); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
ensure that this path (or set of paths after wildcard expansion)&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
is on the filesystem. A wildcard can never expand to span multiple&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
providers.&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (IsFileSystemPath(provider,
path) == &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;) &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
no, so skip to next path in _paths.&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;continue&lt;/span&gt;; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
at this point, we have a list of paths on the filesystem.&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; filePath &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; filePaths) &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    PSObject custom;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
If -whatif was supplied, do not perform the actions&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
inside this "if" statement; only show the message.&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
This block also supports the -confirm switch, where&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
you will be asked if you want to perform the action&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #008000"&gt;//
"get metadata" on target: foo.txt&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ShouldProcess(filePath,
"&lt;span style="color: #8b0000"&gt;Get Metadata&lt;/span&gt;")) &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Directory.Exists(filePath)) &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                            custom = GetDirectoryCustomObject(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DirectoryInfo(filePath)); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                            custom = GetFileCustomObject(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; FileInfo(filePath)); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                        WriteObject(custom);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; PSObject
GetFileCustomObject(FileInfo file) &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;//
this message will be shown if the -verbose switch is given&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            WriteVerbose("&lt;span style="color: #8b0000"&gt;GetFileCustomObject &lt;/span&gt;"
+ file); &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;//
create a custom object with a few properties&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            PSObject custom = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PSObject(); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            custom.Properties.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PSNoteProperty("&lt;span style="color: #8b0000"&gt;Size&lt;/span&gt;",
file.Length)); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            custom.Properties.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PSNoteProperty("&lt;span style="color: #8b0000"&gt;Name&lt;/span&gt;",
file.Name)); &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            custom.Properties.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PSNoteProperty("&lt;span style="color: #8b0000"&gt;Extension&lt;/span&gt;",
file.Extension)); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; custom; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; PSObject
GetDirectoryCustomObject(DirectoryInfo dir) &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;//
this message will be shown if the -verbose switch is given&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            WriteVerbose("&lt;span style="color: #8b0000"&gt;GetDirectoryCustomObject &lt;/span&gt;"
+ dir); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;//
create a custom object with a few properties&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            PSObject custom = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PSObject(); &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; files
= dir.GetFiles().Length; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; subdirs
= dir.GetDirectories().Length; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            custom.Properties.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PSNoteProperty("&lt;span style="color: #8b0000"&gt;Files&lt;/span&gt;",
files)); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            custom.Properties.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PSNoteProperty("&lt;span style="color: #8b0000"&gt;Subdirectories&lt;/span&gt;",
subdirs)); &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            custom.Properties.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PSNoteProperty("&lt;span style="color: #8b0000"&gt;Name&lt;/span&gt;",
dir.Name)); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; custom; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; IsFileSystemPath(ProviderInfo
provider, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; path) &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; isFileSystem
= &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;//
check that this provider is the filesystem&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (provider.ImplementingType
!= &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(FileSystemProvider)) &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
create a .NET exception wrapping our error text&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                ArgumentException ex = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ArgumentException(path
+ &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    "&lt;span style="color: #8b0000"&gt; does
not resolve to a path on the FileSystem provider.&lt;/span&gt;"); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
wrap this in a powershell errorrecord&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                ErrorRecord error = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ErrorRecord(ex,
"&lt;span style="color: #8b0000"&gt;InvalidProvider&lt;/span&gt;", &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    ErrorCategory.InvalidArgument, path);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
write a non-terminating error to pipeline&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.WriteError(error); &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #008000"&gt;//
tell our caller that the item was not on the filesystem&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                isFileSystem = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; isFileSystem; &lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=ff314040-e2e2-4237-bde6-15e8969c0a99" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,ff314040-e2e2-4237-bde6-15e8969c0a99.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=eb987998-0302-4577-83fb-0709c363ea88</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,eb987998-0302-4577-83fb-0709c363ea88.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,eb987998-0302-4577-83fb-0709c363ea88.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=eb987998-0302-4577-83fb-0709c363ea88</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Here’s just a quick rundown of the changes in <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a> 2.0
in comparison to the last public release, CTP2. This may be helpful to those of you
who don’t have access to the Windows 7 PDC bits. <strong><font color="#d90000">Remember,
things are still subject to change - it’s not in beta yet.</font></strong></p>
        <p>
Unchanged cmdlets are not listed here.
</p>
        <table border="1" cellspacing="0" cellpadding="2" width="578">
          <tbody>
            <tr>
              <td valign="top" colspan="3">
                <p align="center">
                  <strong>Added (or renamed*) Cmdlets</strong>
                </p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="206" nowrap="nowrap">
Enter-PSSession<br />
Remove-PSSession<br />
Get-PSSession<br />
Exit-PSSession<br />
Get-PSSessionConfiguration<br />
Unregister-PSSessionConfiguration<br />
Register-PSSessionConfiguration<br />
Debug-Process<br />
Test-ModuleManifest<br />
New-ModuleManifest<br />
New-WSManSessionOption<br />
New-PSSession<br />
Import-PSSession<br />
Export-PSSession<br />
Set-PSSessionConfiguration<br />
Get-WSManInstance<br />
Get-WSManCredSSP<br />
Enable-WSManCredSSP<br />
Set-WSManInstance<br />
Set-WSManQuickConfig<br />
New-WSManInstance<br />
Remove-WSManInstance</td>
              <td valign="top" width="187">
Ping-WSMan<br />
New-WebServiceProxy<br />
Get-PSTransaction<br />
Connect-WSMan<br />
Disable-WSManCredSSP<br />
Invoke-WSManAction<br />
Disconnect-WSMan<br />
Get-ComputerRestorePoint<br />
Disable-ComputerRestore<br />
Enable-ComputerRestore<br />
Get-Counter<br />
Clear-EventLog<br />
Export-Counter<br />
Import-Counter<br />
Checkpoint-Computer<br />
Restart-Computer<br />
Stop-Computer<br />
Ping-Computer<br /></td>
              <td valign="top" width="183">
Resume-BitsTransfer<br />
Set-BitsTransfer<br />
Suspend-BitsTransfer<br />
Add-BitsFile<br />
Clear-BitsTransfer<br />
Remove-EventLog<br />
Restore-Computer<br />
New-Module<br />
Get-HotFix<br />
Complete-BitsTransfer<br />
Write-EventLog<br />
Show-EventLog<br />
Limit-EventLog<br />
Get-BitsTransfer<br />
New-BitsTransfer<br />
New-EventLog</td>
            </tr>
            <tr>
              <td valign="top" colspan="3" align="middle">
                <p align="center">
                  <strong>Changed Cmdlets (parameter or parameterset differences)</strong>
                </p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="206" nowrap="nowrap">
                <p>
Invoke-Command<br />
Receive-PSJob<br />
Set-WmiInstance<br />
Stop-PSJob<br />
Wait-PSJob<br />
Remove-PSJob<br />
Export-ModuleMember<br />
Start-PSJob<br />
Get-PSJob<br />
Add-Module<br />
Set-Service
</p>
              </td>
              <td valign="top" width="187">
 </td>
              <td valign="top" width="183">
 </td>
            </tr>
            <tr>
              <td valign="top" colspan="3">
                <p align="center">
                  <strong>Removed (or renamed*) Cmdlets</strong>
                </p>
              </td>
            </tr>
            <tr>
              <td valign="top" width="206" nowrap="nowrap">
                <p>
Pop-Runspace<br />
New-Runspace<br />
Push-Runspace<br />
Get-Runspace<br />
Remove-Runspace
</p>
              </td>
              <td valign="top" width="189">
 </td>
              <td valign="top" width="188">
 </td>
            </tr>
          </tbody>
        </table>
        <p>
* e.g. The *-Runspace Cmdlets have been renamed to *-PSSession
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=eb987998-0302-4577-83fb-0709c363ea88" />
      </body>
      <title>Changes from CTP2 in PowerShell 2.0 in the Windows 7 M3 “PDC” Build</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,eb987998-0302-4577-83fb-0709c363ea88.aspx</guid>
      <link>http://www.nivot.org/2008/11/14/ChangesFromCTP2InPowerShell20InTheWindows7M3PDCBuild.aspx</link>
      <pubDate>Fri, 14 Nov 2008 04:15:00 GMT</pubDate>
      <description>&lt;p&gt;
Here’s just a quick rundown of the changes in &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;PowerShell&lt;/a&gt; 2.0
in comparison to the last public release, CTP2. This may be helpful to those of you
who don’t have access to the Windows 7 PDC bits. &lt;strong&gt;&lt;font color="#d90000"&gt;Remember,
things are still subject to change - it’s not in beta yet.&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Unchanged cmdlets are not listed here.
&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="2" width="578"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" colspan="3"&gt;
&lt;p align="center"&gt;
&lt;strong&gt;Added (or renamed*) Cmdlets&lt;/strong&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="206" nowrap&gt;
Enter-PSSession&lt;br&gt;
Remove-PSSession&lt;br&gt;
Get-PSSession&lt;br&gt;
Exit-PSSession&lt;br&gt;
Get-PSSessionConfiguration&lt;br&gt;
Unregister-PSSessionConfiguration&lt;br&gt;
Register-PSSessionConfiguration&lt;br&gt;
Debug-Process&lt;br&gt;
Test-ModuleManifest&lt;br&gt;
New-ModuleManifest&lt;br&gt;
New-WSManSessionOption&lt;br&gt;
New-PSSession&lt;br&gt;
Import-PSSession&lt;br&gt;
Export-PSSession&lt;br&gt;
Set-PSSessionConfiguration&lt;br&gt;
Get-WSManInstance&lt;br&gt;
Get-WSManCredSSP&lt;br&gt;
Enable-WSManCredSSP&lt;br&gt;
Set-WSManInstance&lt;br&gt;
Set-WSManQuickConfig&lt;br&gt;
New-WSManInstance&lt;br&gt;
Remove-WSManInstance&lt;/td&gt;
&lt;td valign="top" width="187"&gt;
Ping-WSMan&lt;br&gt;
New-WebServiceProxy&lt;br&gt;
Get-PSTransaction&lt;br&gt;
Connect-WSMan&lt;br&gt;
Disable-WSManCredSSP&lt;br&gt;
Invoke-WSManAction&lt;br&gt;
Disconnect-WSMan&lt;br&gt;
Get-ComputerRestorePoint&lt;br&gt;
Disable-ComputerRestore&lt;br&gt;
Enable-ComputerRestore&lt;br&gt;
Get-Counter&lt;br&gt;
Clear-EventLog&lt;br&gt;
Export-Counter&lt;br&gt;
Import-Counter&lt;br&gt;
Checkpoint-Computer&lt;br&gt;
Restart-Computer&lt;br&gt;
Stop-Computer&lt;br&gt;
Ping-Computer&lt;br&gt;
&lt;/td&gt;
&lt;td valign="top" width="183"&gt;
Resume-BitsTransfer&lt;br&gt;
Set-BitsTransfer&lt;br&gt;
Suspend-BitsTransfer&lt;br&gt;
Add-BitsFile&lt;br&gt;
Clear-BitsTransfer&lt;br&gt;
Remove-EventLog&lt;br&gt;
Restore-Computer&lt;br&gt;
New-Module&lt;br&gt;
Get-HotFix&lt;br&gt;
Complete-BitsTransfer&lt;br&gt;
Write-EventLog&lt;br&gt;
Show-EventLog&lt;br&gt;
Limit-EventLog&lt;br&gt;
Get-BitsTransfer&lt;br&gt;
New-BitsTransfer&lt;br&gt;
New-EventLog&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" colspan="3" align="middle"&gt;
&lt;p align="center"&gt;
&lt;strong&gt;Changed Cmdlets (parameter or parameterset differences)&lt;/strong&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="206" nowrap&gt;
&lt;p&gt;
Invoke-Command&lt;br&gt;
Receive-PSJob&lt;br&gt;
Set-WmiInstance&lt;br&gt;
Stop-PSJob&lt;br&gt;
Wait-PSJob&lt;br&gt;
Remove-PSJob&lt;br&gt;
Export-ModuleMember&lt;br&gt;
Start-PSJob&lt;br&gt;
Get-PSJob&lt;br&gt;
Add-Module&lt;br&gt;
Set-Service
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="187"&gt;
&amp;nbsp;&lt;/td&gt;
&lt;td valign="top" width="183"&gt;
&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" colspan="3"&gt;
&lt;p align="center"&gt;
&lt;strong&gt;Removed (or renamed*) Cmdlets&lt;/strong&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="206" nowrap&gt;
&lt;p&gt;
Pop-Runspace&lt;br&gt;
New-Runspace&lt;br&gt;
Push-Runspace&lt;br&gt;
Get-Runspace&lt;br&gt;
Remove-Runspace
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="189"&gt;
&amp;nbsp;&lt;/td&gt;
&lt;td valign="top" width="188"&gt;
&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
* e.g. The *-Runspace Cmdlets have been renamed to *-PSSession
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=eb987998-0302-4577-83fb-0709c363ea88" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,eb987998-0302-4577-83fb-0709c363ea88.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>Windows 7</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=775897d5-6c8b-46b3-94fe-cace9b5d3477</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,775897d5-6c8b-46b3-94fe-cace9b5d3477.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,775897d5-6c8b-46b3-94fe-cace9b5d3477.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=775897d5-6c8b-46b3-94fe-cace9b5d3477</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Fellow <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a> MVP
and <strike>developer</strike> all-round expert administrator <a target="_blank" href="http://www.bsonposh.com/">Brandon
Shell</a> asked me how he could navigate to a Cmdlet’s implementation in Lutz Roeder’s <a target="_blank" href="http://www.red-gate.com/products/reflector/">Reflector</a> --
which has now been acquired by Red-Gate Software btw. At first I was going to explain
to him how snap-ins work and how to figure out where things are, and then a really
simple trick hit me that uses some fairly secret command-line parameter that Reflector
can accept, namely the /select parameter:
</p>
        <!-- Stylesheet link -->
        <link rel="stylesheet" type="text/css" href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css" />
        <!-- Code -->
        <div id="hlDiv" class="dp-highlighter">
          <div class="bar">
          </div>
          <ol class="dp-rb">
            <li class="alt">
              <span>
                <span class="keyword">function</span>
                <span> Reflect-Cmdlet {   </span>
              </span>
            </li>
            <li>
              <span>    </span>
              <span class="keyword">param</span>
              <span>([Management.Automation.CommandInfo]</span>
              <span class="variable">$command</span>
              <span>)   </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">if</span>
              <span> (</span>
              <span class="variable">$input</span>
              <span>)
{   </span>
            </li>
            <li>
              <span>        trap { </span>
              <span class="variable">$_</span>
              <span>;
break }   </span>
            </li>
            <li class="alt">
              <span>        </span>
              <span class="variable">$command</span>
              <span> = </span>
              <span class="variable">$input</span>
              <span> |
select -first 1   </span>
            </li>
            <li>
              <span>    }       </span>
            </li>
            <li class="alt">
              <span>          </span>
            </li>
            <li>
              <span>    </span>
              <span class="comment"># resolve to command if this
is an alias </span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="keyword">while</span>
              <span> (</span>
              <span class="variable">$command</span>
              <span>.CommandType
-eq </span>
              <span class="string">"Alias"</span>
              <span>) {   </span>
            </li>
            <li>
              <span>        </span>
              <span class="variable">$command</span>
              <span> = </span>
              <span class="builtin">Get-Command</span>
              <span> (</span>
              <span class="variable">$command</span>
              <span>.definition)   </span>
            </li>
            <li class="alt">
              <span>    }   </span>
            </li>
            <li>
              <span>       </span>
            </li>
            <li class="alt">
              <span>    </span>
              <span class="variable">$name</span>
              <span> = </span>
              <span class="variable">$command</span>
              <span>.ImplementingType       </span>
            </li>
            <li>
              <span>    </span>
              <span class="variable">$DLL</span>
              <span> = </span>
              <span class="variable">$command</span>
              <span>.DLL   </span>
            </li>
            <li class="alt">
              <span>       </span>
            </li>
            <li>
              <span>    </span>
              <span class="keyword">if</span>
              <span> (-not (gcm reflector.exe
-ea silentlycontinue)) {   </span>
            </li>
            <li class="alt">
              <span>        throw </span>
              <span class="string">"I
can't find Reflector.exe in your path."</span>
              <span>  </span>
            </li>
            <li>
              <span>    }   </span>
            </li>
            <li class="alt">
              <span>        </span>
            </li>
            <li>
              <span>    reflector /select:</span>
              <span class="variable">$name</span>
              <span> </span>
              <span class="variable">$DLL</span>
              <span>  </span>
            </li>
            <li class="alt">
              <span>}  </span>
            </li>
          </ol>
        </div>
        <p>
Just pipe the output of get-command to it, like: <font size="4" face="Cordia New"><strong>gcm
dir | reflect-cmdlet</strong></font> and Reflector will open up with the class selected
(it takes a few seconds).
</p>
        <p>
          <strong>Update: </strong>Doug pointed out in a comment that the gcm reflector.exe
line could benefit from an erroraction to keep it silent on failure, so only the throw
message shows. Thanks Doug!
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=775897d5-6c8b-46b3-94fe-cace9b5d3477" />
      </body>
      <title>A trick to jump directly to a Cmdlet’s implementation in Reflector</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,775897d5-6c8b-46b3-94fe-cace9b5d3477.aspx</guid>
      <link>http://www.nivot.org/2008/10/30/ATrickToJumpDirectlyToACmdletsImplementationInReflector.aspx</link>
      <pubDate>Thu, 30 Oct 2008 18:44:40 GMT</pubDate>
      <description>&lt;p&gt;
Fellow &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;PowerShell&lt;/a&gt; MVP
and &lt;strike&gt;developer&lt;/strike&gt; all-round expert administrator &lt;a target=_blank href="http://www.bsonposh.com/"&gt;Brandon
Shell&lt;/a&gt; asked me how he could navigate to a Cmdlet’s implementation in Lutz Roeder’s &lt;a target=_blank href="http://www.red-gate.com/products/reflector/"&gt;Reflector&lt;/a&gt; --
which has now been acquired by Red-Gate Software btw. At first I was going to explain
to him how snap-ins work and how to figure out where things are, and then a really
simple trick hit me that uses some fairly secret command-line parameter that Reflector
can accept, namely the /select parameter:
&lt;/p&gt;
&lt;!-- Stylesheet link --&gt;
&lt;link rel=stylesheet type=text/css href="http://www.thecomplex.plus.com/styles/SyntaxHighlighter.css"&gt;
&lt;!-- Code --&gt;
&lt;div id=hlDiv class=dp-highlighter&gt;
&lt;div class=bar&gt;
&lt;/div&gt;
&lt;ol class=dp-rb&gt;
&lt;li class=alt&gt;
&lt;span&gt;&lt;span class=keyword&gt;function&lt;/span&gt;&lt;span&gt; Reflect-Cmdlet {&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=keyword&gt;param&lt;/span&gt;&lt;span&gt;([Management.Automation.CommandInfo]&lt;/span&gt;&lt;span class=variable&gt;$command&lt;/span&gt;&lt;span&gt;)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=keyword&gt;if&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=variable&gt;$input&lt;/span&gt;&lt;span&gt;)
{&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trap { &lt;/span&gt;&lt;span class=variable&gt;$_&lt;/span&gt;&lt;span&gt;;
break }&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=variable&gt;$command&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span class=variable&gt;$input&lt;/span&gt;&lt;span&gt; |
select -first 1&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=comment&gt;# resolve to command if this is
an alias &lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=keyword&gt;while&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=variable&gt;$command&lt;/span&gt;&lt;span&gt;.CommandType
-eq &lt;/span&gt;&lt;span class=string&gt;"Alias"&lt;/span&gt;&lt;span&gt;) {&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=variable&gt;$command&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span class=builtin&gt;Get-Command&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=variable&gt;$command&lt;/span&gt;&lt;span&gt;.definition)&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=variable&gt;$name&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span class=variable&gt;$command&lt;/span&gt;&lt;span&gt;.ImplementingType&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=variable&gt;$DLL&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span class=variable&gt;$command&lt;/span&gt;&lt;span&gt;.DLL&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class=keyword&gt;if&lt;/span&gt;&lt;span&gt; (-not (gcm reflector.exe
-ea silentlycontinue)) {&amp;nbsp;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw &lt;/span&gt;&lt;span class=string&gt;"I
can't find Reflector.exe in your path."&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li class=alt&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li&gt;
&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reflector /select:&lt;/span&gt;&lt;span class=variable&gt;$name&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=variable&gt;$DLL&lt;/span&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&gt; 
&lt;li class=alt&gt;
&lt;span&gt;}&amp;nbsp; &lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
Just pipe the output of get-command to it, like: &lt;font size=4 face="Cordia New"&gt;&lt;strong&gt;gcm
dir | reflect-cmdlet&lt;/strong&gt;&lt;/font&gt; and Reflector will open up with the class selected
(it takes a few seconds).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update: &lt;/strong&gt;Doug pointed out in a comment that the gcm reflector.exe
line could benefit from an erroraction to keep it silent on failure, so only the throw
message shows. Thanks Doug!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=775897d5-6c8b-46b3-94fe-cace9b5d3477" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,775897d5-6c8b-46b3-94fe-cace9b5d3477.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=a69ea7cd-8f3a-40a7-a2cf-e0bfa249ab3f</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,a69ea7cd-8f3a-40a7-a2cf-e0bfa249ab3f.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,a69ea7cd-8f3a-40a7-a2cf-e0bfa249ab3f.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=a69ea7cd-8f3a-40a7-a2cf-e0bfa249ab3f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The verbs list for naming your Cmdlets is pretty strict. You should definitely
try to pick one of the known verbs. You can see them here:
</p>
        <p>
          <font face="Courier New">function Get-Verb {<br />
    [psobject].assembly.getexportedtypes() | `<br />
        ? {$_.name -like "Verbs*"} | gm -static
-membertype property | `<br />
        sort Name | select Name<br />
}</font>
        </p>
        <p>
          <font face="Courier New">ps&gt; Get-Verb</font>
        </p>
        <p>
The noun end of the spectrum is pretty open-ended. Single nouns are better, and try
to use the singular if you can. Cmdlets typically return <strong>one</strong> or more
objects. so the singular form is the convention - better than trying to name your
Cmdlet "Get-Noun(s)" which is just plain silly. 
</p>
        <p>
To prefix or not to prefix: this is a sticky one. The Religious Right, aka the Microsoft
Powershell team, dictate that you should not prefix. The reality is more complicated
and is under constant debate. If you pick a verb-noun pair that already exists and
is currently loaded into powershell, you must disambiguate the command with the snapin
name (snapinname\verb-noun) or it won't run. The snapin name is typically long and
ugly. A noun prefix is typically short and sweet. The problem with the latter is that
your commands are now harder to discover for someone who doesn't know they are there
(and as such doesn't know your magic prefix). Ultimately though, people load your
snapin explicitly and should know the prefix, so I tend to lean towards this although
I feel a strong connection with the "One Noun Way."
</p>
        <p>
(taken from one of my newgroup posts)
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=a69ea7cd-8f3a-40a7-a2cf-e0bfa249ab3f" />
      </body>
      <title>Naming your Cmdlets and Functions: Verbs and Nouns</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,a69ea7cd-8f3a-40a7-a2cf-e0bfa249ab3f.aspx</guid>
      <link>http://www.nivot.org/2008/10/15/NamingYourCmdletsAndFunctionsVerbsAndNouns.aspx</link>
      <pubDate>Wed, 15 Oct 2008 16:20:19 GMT</pubDate>
      <description>&lt;p&gt;
The verbs list for naming your Cmdlets&amp;nbsp;is pretty strict. You should definitely
try to pick one of the known verbs. You can see them here:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;function Get-Verb {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [psobject].assembly.getexportedtypes() | `&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ? {$_.name -like "Verbs*"} | gm -static
-membertype property | `&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sort Name | select Name&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;ps&amp;gt; Get-Verb&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The noun end of the spectrum is pretty open-ended. Single nouns are better, and try
to use the singular if you can. Cmdlets typically return &lt;strong&gt;one&lt;/strong&gt; or more
objects. so the singular form is the convention - better than trying to name your
Cmdlet "Get-Noun(s)" which is just plain silly. 
&lt;/p&gt;
&lt;p&gt;
To prefix or not to prefix: this is a sticky one. The Religious Right, aka the Microsoft
Powershell team, dictate that you should not prefix. The reality is more complicated
and is under constant debate. If you pick a verb-noun pair that already exists and
is currently loaded into powershell, you must disambiguate the command with the snapin
name (snapinname\verb-noun) or it won't run. The snapin name is typically long and
ugly. A noun prefix is typically short and sweet. The problem with the latter is that
your commands are now harder to discover for someone who doesn't know they are there
(and as such doesn't know your magic prefix). Ultimately though, people load your
snapin explicitly and should know the prefix, so I tend to lean towards this although
I feel a strong&amp;nbsp;connection with the "One Noun Way."
&lt;/p&gt;
&lt;p&gt;
(taken from&amp;nbsp;one of my&amp;nbsp;newgroup posts)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=a69ea7cd-8f3a-40a7-a2cf-e0bfa249ab3f" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,a69ea7cd-8f3a-40a7-a2cf-e0bfa249ab3f.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>PowerShell 2.0</category>
      <category>SnapIns</category>
    </item>
    <item>
      <trackback:ping>http://www.nivot.org/Trackback.aspx?guid=7ac02da0-f9a0-443e-9f3d-f187e1ea7502</trackback:ping>
      <pingback:server>http://www.nivot.org/pingback.aspx</pingback:server>
      <pingback:target>http://www.nivot.org/PermaLink,guid,7ac02da0-f9a0-443e-9f3d-f187e1ea7502.aspx</pingback:target>
      <dc:creator>Oisin Grehan</dc:creator>
      <wfw:comment>http://www.nivot.org/CommentView,guid,7ac02da0-f9a0-443e-9f3d-f187e1ea7502.aspx</wfw:comment>
      <wfw:commentRss>http://www.nivot.org/SyndicationService.asmx/GetEntryCommentsRss?guid=7ac02da0-f9a0-443e-9f3d-f187e1ea7502</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It’s getting harder to post useful scripting tips for <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">PowerShell</a> these
days as there <a href="http://huddledmasses.org/" target="_blank">are</a><a href="http://bsonposh.com/" target="_blank">so</a><a href="http://thepowershellguy.com/blogs/posh/default.aspx" target="_blank">many</a><a href="http://keithhill.spaces.live.com/" target="_blank">talented</a><a href="http://www.proudlyserving.com/" target="_blank">hardcore</a><a href="http://marcoshaw.blogspot.com/" target="_blank">scripting</a><a href="http://dmitrysotnikov.wordpress.com/" target="_blank">bloggers</a> around.
My day to day is job is not system/network/server administrator; I’m a .NET developer,
having started the C# habit about eight or nine years ago with the early CLR 1.0 beta.
So, from here on in, I’ve decided that a better direction for me to take from now
on is that of a PowerShell developer,  as opposed to a scripter. There are very
few (if any?) dedicated PowerShell developer blogs around, and so I figured I should
try to fill that gap as best I can. I have a not insignificant amount of experience
writing providers, cmdlets and other widgety bits, so it’s a good time to share my
experiences. Of course, my way is not “the” way, so please reply with your own experiences/advice/mocking/whatever.
;-)
</p>
        <p>
That said, I am not eschewing scripting altogether – I have some stuff in the pipeline
(har-har) concerning areas I’m interested in, like eventing and jobs/remoting.
</p>
        <img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=7ac02da0-f9a0-443e-9f3d-f187e1ea7502" />
      </body>
      <title>Time For A Change</title>
      <guid isPermaLink="false">http://www.nivot.org/PermaLink,guid,7ac02da0-f9a0-443e-9f3d-f187e1ea7502.aspx</guid>
      <link>http://www.nivot.org/2008/08/12/TimeForAChange.aspx</link>
      <pubDate>Tue, 12 Aug 2008 14:03:20 GMT</pubDate>
      <description>&lt;p&gt;
It’s getting harder to post useful scripting tips for &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;PowerShell&lt;/a&gt; these
days as there &lt;a href="http://huddledmasses.org/" target="_blank"&gt;are&lt;/a&gt; &lt;a href="http://bsonposh.com/" target="_blank"&gt;so&lt;/a&gt; &lt;a href="http://thepowershellguy.com/blogs/posh/default.aspx" target="_blank"&gt;many&lt;/a&gt; &lt;a href="http://keithhill.spaces.live.com/" target="_blank"&gt;talented&lt;/a&gt; &lt;a href="http://www.proudlyserving.com/" target="_blank"&gt;hardcore&lt;/a&gt; &lt;a href="http://marcoshaw.blogspot.com/" target="_blank"&gt;scripting&lt;/a&gt; &lt;a href="http://dmitrysotnikov.wordpress.com/" target="_blank"&gt;bloggers&lt;/a&gt; around.
My day to day is job is not system/network/server administrator; I’m a .NET developer,
having started the C# habit about eight or nine years ago with the early CLR 1.0 beta.
So, from here on in, I’ve decided that a better direction for me to take from now
on is that of a PowerShell developer,&amp;nbsp; as opposed to a scripter. There are very
few (if any?) dedicated PowerShell developer blogs around, and so I figured I should
try to fill that gap as best I can. I have a not insignificant amount of experience
writing providers, cmdlets and other widgety bits, so it’s a good time to share my
experiences. Of course, my way is not “the” way, so please reply with your own experiences/advice/mocking/whatever.
;-)
&lt;/p&gt;
&lt;p&gt;
That said, I am not eschewing scripting altogether – I have some stuff in the pipeline
(har-har) concerning areas I’m interested in, like eventing and jobs/remoting.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.nivot.org/aggbug.ashx?id=7ac02da0-f9a0-443e-9f3d-f187e1ea7502" /&gt;</description>
      <comments>http://www.nivot.org/CommentView,guid,7ac02da0-f9a0-443e-9f3d-f187e1ea7502.aspx</comments>
      <category>.NET</category>
      <category>Cmdlets</category>
      <category>Monad</category>
      <category>PowerShell</category>
      <category>Providers</category>
      <category>PSCX</category>
      <category>PSEventing</category>
      <category>SharePoint</category>
      <category>SnapIns</category>
    </item>
  </channel>
</rss>