{"id":10581,"date":"2006-04-25T12:18:19","date_gmt":"2006-04-25T12:18:19","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2006\/04\/25\/finding-which-parameters-are-used-the-most\/"},"modified":"2019-02-18T13:24:55","modified_gmt":"2019-02-18T20:24:55","slug":"finding-which-parameters-are-used-the-most","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/finding-which-parameters-are-used-the-most\/","title":{"rendered":"Finding which parameters are used the most"},"content":{"rendered":"<p class=\"MsoNormal\"><span>We are in the process of cleaning up our Cmdlets and ensuring that they are consistent.<span>&nbsp; One of the things we want to do is the ensure that we provide Aliases for ParameterNames.&nbsp; As a general rule, parameternames are not pithy.&nbsp; That is great for reading scripts but can be a pain during interactive sessions.&nbsp; You only have to provide enough of a parametername to disambiguate it but you can also use parameter aliases if they are defined.&nbsp; For instance, you can type -OutVariable or you can type -ov because all the commands provide the alias &#8220;ov&#8221; to map to &#8220;OutVariable&#8221;.&nbsp; <\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span><span><\/span><\/span>&nbsp;<\/p>\n<p class=\"MsoNormal\"><span><span><\/span>The task at hand is to ensure that we make good use of parameter aliases.&nbsp; As always, \u201cto ship is to choose\u201d.<span>&nbsp; <\/span>That means that we don\u2019t time to do everything so we have to focus on the things that are going to produce the biggest bang for the buck.<span>&nbsp; <\/span>Here I walk through the steps to get a histogram of parameter use by all the Cmdlets.<span>&nbsp;&nbsp; <\/span>Let\u2019s break that down into steps:<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>1)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Get all the Cmdlets<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>2)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Get all the parameters of all the Cmdlets<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>3)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Create a histogram<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Getting all the Cmdlets is pretty simple to do \u2013 we provide the \u201cGet-Command\u201d function which has the alias \u201cgcm\u201d<\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong>gcm<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">CommandType<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Definition<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">&#8212;&#8212;&#8212;&#8211;<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;-<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Cmdlet<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>add-content<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>add-content [-Path] St&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Cmdlet<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>add-history<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>add-history [[-InputOb&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">\u2026.<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>If you provide no parameters, gcm returns the list of all Cmdlets.<span>&nbsp; <\/span>If you provide a name specifier (you can use wildcards), then it returns everything that can resolve a token.<span>&nbsp; <\/span>You can type \u201cgcm *\u201d to see what that looks like.<span>&nbsp; <\/span>I\u2019ll group them to show you want I mean:<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong>gcm * |Group CommandType |Sort name<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Count Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Group<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">&#8212;&#8211; &#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp; <\/span>120 Alias<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{ac, alias, aliases, cat, cd, ch&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;<\/span>2746 Application<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{$ncsp$.inf, $winnt$.inf, _defau&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp; <\/span>128 Cmdlet<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{add-content, add-history, add-m&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp; <\/span>25 ExternalScript<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{aliases.msh, aspen.msh, burn-co&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp; <\/span>64 Function<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{&#8230;, A:, Alias:, Aspen:, B:, C:&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>For this work, we are only interested in Cmdlets so how do we find just the Cmdlets?<span>&nbsp; <\/span><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>The thing I love about Monad is that with a few concepts, you can do almost anything. <span>&nbsp;<\/span>Since you know that gcm returns objects and you know that you can filter objects using \u201cwhere\u201d, the following gives you exactly what you want:<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong><font>gcm * |where {$_.CommandType -eq &#8220;Cmdlet&#8221;}<\/font><\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>With that as a baseline, let\u2019s explore whether there is a better way to do things.<span>&nbsp; <\/span>Type \u201cgcm -?\u201d and you\u2019ll get help on \u201cGet-Command\u201d and it will tell you all sorts of wonderful things.<span>&nbsp; <\/span>I\u2019m one of those \u201cless is more\u201d type of readers so I often just want the examples. I do this to get just the examples:<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong>(gcm -?).Examples<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>In this case it doesn\u2019t tell me what I wanted to see (looks like we need to cleanup our help as well <\/span><span><span>J<\/span><\/span><span>) so let\u2019s use gcm on Get-Command:<\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong>gcm Get-Command |fl *<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">DLL<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: C:\\WINDOWS\\assembly\\GAC_MSIL\\System.Management.Auto<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>mation\\1.0.7487.0__31bf3856ad364e35\\System.Manageme<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>nt.Automation.dll<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Verb<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: get<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Noun<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: command<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">HelpFile<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;<\/span>: System.Management.Automation.dll-Help.xml<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MshSnapIn<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: Microsoft.Management.Automation.Core<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Type<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: System.Management.Automation.Commands.GetCommand<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#a52a2a\">ParameterSets : {CmdletSet, AllCommandSet}<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Definition<span>&nbsp;&nbsp;&nbsp; <\/span>: get-command [[-CommandArguments] Object[]] [-Verb S<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>tring[]] [-Noun String[]] [-MshSnapin String[]] [-T<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>otalCount Int32] [-Synopsis] [-Verbose] [-Debug] [-<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ErrorAction ActionPreference] [-ErrorVariable Strin<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>g] [-OutVariable String] [-OutBuffer Int32]<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>get-command [[-Name] String[]] [[-CommandArguments]<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Object[]] <strong><font color=\"#a52a2a\">[-Type CommandTypes]<\/font><\/strong> [-TotalCount Int32]<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>[-Synopsis] [-Verbose] [-Debug] [-ErrorAction Acti<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>onPreference] [-ErrorVariable String] [-OutVariable<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>String] [-OutBuffer Int32]<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: get-command<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">CommandType<span>&nbsp;&nbsp; <\/span>: Cmdlet<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>This tells me that I can use \u201c-Type Cmdlet\u201d to get just the items I want:<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong>gcm \u2013Type Cmdlet<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Notice also that gcm shows you the ParameterSets.<span>&nbsp; <\/span>Every command can have multiple sets of parameters.<span>&nbsp; <\/span>For instance you can do a \u201cget-process\u201d specifying either an ID or a ProcessName or by pipelining a set of instance to the command.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong>(gcm get-process).parametersets |ft name,parameters -Auto<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Parameters<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;-<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">ProcessName {ProcessName, Verbose, Debug, ErrorAction, ErrorVari&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Id<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Id, Verbose, Debug, ErrorAction, ErrorVariable, Out&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Input<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Input, Verbose, Debug, ErrorAction, ErrorVariable, &#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>So now what we want to do is to get all the parameters of all the ParameterSets of all the commands which are Cmdlets.<span>&nbsp; <\/span>First let\u2019s get all the ParameterSets.<span>&nbsp; <\/span>We know that gcm returns all the properties of the Cmdlet and that \u201cselect\u201d can be used to pick just those properties that we want so it seems like we should be able to do the following:<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong>gcm -type Cmdlet |Select ParameterSets<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Do this and you\u2019ll discover that it doesn\u2019t quite give you want you want because Parametersets is a Collection.<span>&nbsp; <\/span>That command sequence returns a stream of collections when what we want is a stream of objects.<span>&nbsp; <\/span>This is what \u201cSelect \u2013Expand \u201c is designed to do.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; gcm -type Cmdlet |Select -Expand ParameterSets |Select -Expand<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Parameters<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: Value<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Type<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: System.Object[]<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">IsMandatory<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: True<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">IsDynamic<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: False<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Position<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: 1<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">ValueFromPipeline<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: True<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">ValueFromPipelineByPropertyName : True<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">ValueFromRemainingArguments<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: False<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">HelpMessage<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>:<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Aliases<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: {}<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Attributes<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: {System.Management.Automation.All<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>owNullAttribute, System.Managemen<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>t.Automation.AllowEmptyCollection<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\"><span>&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>Attribute, __AllParameterSets}<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">\u2026.<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Now we are ready to party.<span>&nbsp; <\/span>Let\u2019s put these parameters in a variable so the subsequent commandlines are easier to read.<\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">MSH&gt; <strong>$p = gcm -type Cmdlet<span>&nbsp; <\/span>|Select -Expand ParameterSets |Select -Expand Parameters<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Now we want to produce a histogram:<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">MSH&gt; <strong>$p |group Name<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">Count Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Group<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">&#8212;&#8211; &#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>12 Value<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Value, Value, Value, Value, Val&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>47 PassThru<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{PassThru, Passthru, PassThru, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>50 Path<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Path, Path, Path, Path, Path, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>26 Filter<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Filter, Filter, Filter, Filter,&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>49 Include<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Include, Include, Include, Incl&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">\u2026<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>We want to focus on the ones that matter the most so let\u2019s find out which parameters are used the most:<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">MSH&gt; <strong>$p |group Name |sort -Descending count<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">Count Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Group<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">&#8212;&#8211; &#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 ErrorAction<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{ErrorAction, ErrorAction, Error&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 Debug<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Debug, Debug, Debug, Debug, Deb&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 Verbose<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Verbose, Verbose, Verbose, Verb&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 OutBuffer<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{OutBuffer, OutBuffer, OutBuffer&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 OutVariable<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{OutVariable, OutVariable, OutVa&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">\u2026<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Now notice that the most used parameters are the ubiquitous parameters.<span>&nbsp; <\/span>Pretty obvious really, when you think about the word \u201cubiquitous\u201d <\/span><span><span>J<\/span><\/span><span> .<span>&nbsp; <\/span>&lt;Digression \u2013 Cmdlets are subclasses of a base .Net class.<span>&nbsp; <\/span>Ubiquitous parameters are parameters that we put on the base class so that all commands inherit them and whose behavior is implemented by the Monad Cmdlet hosting environment.<span>&nbsp; <\/span>For example, -OutVariable allows you to take the results of a command and assign or append it to a variable [as well as passing it on].<span>&nbsp; <\/span>When a Cmdlet writes its results, Monad looks to see if the user has specified \u2013OutVariable and it does this work [not the Cmdlet].&gt;<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>The command line is about to get large again so let\u2019s put the results into another variable and for yucks let\u2019s use \u2013OutVariable.<span>&nbsp; <\/span>Of course who wants to type \u2013OutVariable so let\u2019s use its alias \u2013ov.<span>&nbsp; <\/span>It turns out that we already have good aliases for the ubiquitous parameters so we want to find the top 20 non-ubiquitous parameters.<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">MSH&gt; <strong>$p |group Name |sort -Descending count \u2013ov p1<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">Count Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Group<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">&#8212;&#8211; &#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 ErrorAction<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{ErrorAction, ErrorAction, Error&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 Debug<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Debug, Debug, Debug, Debug, Deb&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 Verbose<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Verbose, Verbose, Verbose, Verb&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 OutBuffer<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{OutBuffer, OutBuffer, OutBuffer&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp; <\/span>174 OutVariable<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{OutVariable, OutVariable, OutVa&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">\u2026<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>There are 6 ubiquitous parameter so there are 2 ways to get the top 20:<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">MSH&gt; <strong>$p1 |select -first 26 |select -Last 20 \u2013ov p2<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">MSH&gt; <strong>$p1[6..25]<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">Count Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Group<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">&#8212;&#8211; &#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>52 WhatIf<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{WhatIf, WhatIf, WhatIf, WhatIf,&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>52 Confirm<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Confirm, Confirm, Confirm, Conf&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>50 Path<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>{Path, Path, Path, Path, Path, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>50 Exclude<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Exclude, Exclude, Exclude, Excl&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>49 Include<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Include, Include, Include, Incl&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>47 PassThru<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{PassThru, Passthru, PassThru, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>43 Force<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Force, Force, Force, Force, For&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>37 Credential<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Credential, Credential, Credent&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>32 InputObject<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{InputObject, InputObject, Input&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>29 Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Name, Name, Name, Name, Name, N&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>26 Filter<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Filter, Filter, Filter, Filter,&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>20 Property<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Property, Property, Property, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>13 Scope<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Scope, Scope, Scope, Scope, Sco&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>12 Value<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Value, Value, Value, Value, Val&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 Description<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Description, Description, Descr&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 DisplayName<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{DisplayName, DisplayName, Displ&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 ServiceName<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{ServiceName, ServiceName, Servi&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 Input<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Input, Input, Input, Input, Inp&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>6 Type<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Type, Type, Type, Type, Type, T&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>6 Encoding<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Encoding, Encoding, Encoding, E&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Now let\u2019s turn the dial to 11 and see if these things already have aliases and if so, whether there are inconsistent aliases.<span>&nbsp; <\/span>I\u2019m going to make the assumption that if a parameter has an alias, it only has 1 alias (I validated this assumption with the following command \u201c$p2 |select -expand group |where {$_.aliases.count -gt 1}\u201d ).<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>The Group command keeps the things it grouped in a property called group.<span>&nbsp; <\/span>We grouped parameters so this command gets us back the parameters:<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">MSH&gt; <strong>$p2 |select -expand group<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>We now want to group these parameters by Name AND alias.<span>&nbsp; <\/span>The issue is that the parameter class does not have such a property.<span>&nbsp; <\/span>No problem!<span>&nbsp; <\/span>Remember \u2013 Monad is all about helping you cope with a world that doesn\u2019t give you want you need.<span>&nbsp; <\/span>(If it did, you wouldn\u2019t need us <\/span><span><span>J<\/span><\/span><span> ).<span>&nbsp; <\/span>Also remember that there are a small set of KEY MONAD CONCEPTS and TECHNIQUES that you need to learn and then the world is your oyster.<span>&nbsp; <\/span>The technique that saves us here is ScriptBlock Parameters.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>I mentioned that we are turning to dial to 11 didn\u2019t I?<span>&nbsp; <\/span>OK \u2013 put your seatbelt on.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>When you pipeline data to a command, you can specify a ScriptBlock to a parameter that does not take a ScriptBlock.<span>&nbsp; <\/span>The Monad engine detects this and for every pipelined object, it assigns that object to the variable $_, evaluates the ScriptBlock and assigns the results to the parameter.<span>&nbsp; <\/span>Let\u2019s provide a simple example.<span>&nbsp; <\/span>Here we pipe 2 integers to the stop-process command.<span>&nbsp; <\/span>We provide a ScriptBlock to the parameter \u2013ID which only accepts INTs.<span>&nbsp; <\/span>The ScriptBlock issues a prompt and asks the user to enter a process id.<span>&nbsp; <\/span>Monad assigns the pipelined objects (1 and 2) to $_, evaluates the ScriptBlock and passes the parameter to \u2013ProcessName.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">MSH&gt; <strong>1..2 |Stop-Process -ProcessName {Read-host &#8220;Record $_<span>&nbsp; <\/span>Name&#8221; } -whatif<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">Record 1<span>&nbsp; <\/span>Name: lsass<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">What if: Performing operation &#8220;stop-process&#8221; on Target &#8220;lsass (1440)&#8221;.<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">Record 2<span>&nbsp; <\/span>Name: msh<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">What if: Performing operation &#8220;stop-process&#8221; on Target &#8220;msh (3428)&#8221;.<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Back to the problem at hand.<span>&nbsp; <\/span>We want to group these parameters by Name and Alias so let\u2019s use the fact that Group can group by multiple parameters and use a ScriptBlock as one of those parameters:<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">MSH&gt; <strong>$p2|select -Expand Group |group Name,{$_.Aliases[0]} |sort name<\/strong><\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font face=\"Courier New\" color=\"#ff0000\" size=\"1\">&nbsp;<\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">Count Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Group<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\">&#8212;&#8211; &#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>52 Confirm.cf<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Confirm, Confirm, Confirm, Conf&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>37 Credential<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Credential, Credential, Credent&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 Description<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Description, Description, Descr&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 DisplayName<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{DisplayName, DisplayName, Displ&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>6 Encoding<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Encoding, Encoding, Encoding, E&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>50 Exclude<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>{Exclude, Exclude, Exclude, Excl&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>26 Filter<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Filter, Filter, Filter, Filter,&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>43 Force<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Force, Force, Force, Force, For&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>49 Include<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Include, Include, Include, Incl&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 Input<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Input, Input, Input, Input, Inp&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>32 InputObject<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{InputObject, InputObject, Input&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>29 Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Name, Name, Name, Name, Name, N&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>47 PassThru<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{PassThru, Passthru, PassThru, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>2 Path<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Path, Path}<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>48 Path.MshPath<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Path, Path, Path, Path, Path, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>12 Property<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Property, Property, Property, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 Property.MshProperty<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Property, Property, Property, P&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>13 Scope<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Scope, Scope, Scope, Scope, Sco&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>8 ServiceName.Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{ServiceName, ServiceName, Servi&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp;&nbsp; <\/span>6 Type<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Type, Type, Type, Type, Type, T&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>12 Value<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Value, Value, Value, Value, Val&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><font color=\"#ff0000\"><font face=\"Courier New\"><font size=\"1\"><span>&nbsp;&nbsp; <\/span>52 WhatIf.wi<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{WhatIf, WhatIf, WhatIf, WhatIf,&#8230;<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Here it shows that most parameters don\u2019t have an alias and that PATH uses the alias MSHPATH but that 2 commands don\u2019t use this alias which gives us something to investigate.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Here is what I hope you\u2019ve learned from this:<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>1)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Get-Command provides detailed information about anything that can be executed included parameter information for Cmdlets.<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>a.<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Explore how Get-Command returns different data for different types of executables (e.g. <br \/><font face=\"Courier New\"><font size=\"1\"><font color=\"#ff0000\">Get-Command ipconfig.exe |fl *<br \/>Get-Command prompt |fl *<\/font><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>2)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>You can always use WHERE to filter the results of a command but it can be worthwhile investigating whether the command does its own filtering which can sometimes be faster or easier to specify.<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>a.<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Explore how you can leverage the fact that help returns objects so you can craft your own view of help.<span>&nbsp; <\/span>E.g.<br \/><font face=\"Courier New\"><font size=\"1\"><strong><font color=\"#ff0000\">get-help get-* |fl Name,Synopsis<br \/>get-help * |where {$_.Synopsis -match &#8220;process&#8221;} |fl name,Synopsis<\/font><\/strong><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>3)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Commands can have multiple ParameterSets which define valid sets of parameters to perform an operation.<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>a.<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Explore which command has the most ParameterSets.<span>&nbsp; <\/span>Hint \u2013 use a ScriptBlock parameter on group.<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>4)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Select can pick properties of an object and\/or expand the elements of a property if that property is a collection.<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>a.<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Explore the power of both selecting properties and expanding properties. Take the example below and explore each step in the pipeline:<br \/><font face=\"Courier New\"><font size=\"1\"><strong><font color=\"#ff0000\">MSH&gt; gps |select ProcessName -expand Modules -ea silentlycontinue |group ModuleName |sort -Descend count |select -first 20<\/font><\/strong><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>5)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Group can produce a histogram based upon a property or set of properties and keep the original set of objects.<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>a.<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Explore how you can use group to gain insights into your data.<span>&nbsp; <\/span>E.g.<br \/><font face=\"Courier New\"><font size=\"1\"><strong><font color=\"#ff0000\">dir |group {$_.CreationTime.DayOfWeek} |sort Name<br \/>dir |group {$_.CreationTime.DayOfWeek},extension |sort Name<\/font><\/strong><\/font><\/font><\/span><\/p>\n<p class=\"MsoNormal\"><span><span>6)<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>ScriptBlock Parameters can be used in any pipelines to dynamically evaluate what data to pass to a parameter.<\/span><\/p>\n<p class=\"MsoNormal\"><span><span>a.<span>&nbsp;&nbsp;&nbsp; <\/span><\/span><\/span><span>Explore how you can use ScriptBlock parameters to do funky file tree manipulations.<span>&nbsp; <\/span><br \/><font face=\"Courier New\" color=\"#ff0000\" size=\"1\"><strong>dir *zip |cpi -destination {$_.fullname.Replace(&#8220;jps&#8221;,&#8221;BackupJps&#8221;) } \u2013whatif<\/strong><\/font><\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Jeffrey P. Snover [MSFT]<\/span><\/p>\n<p class=\"MsoNormal\"><span>Monad Architect<\/span><\/p>\n<p>[<i>Edit: Monad has now been renamed to Windows PowerShell.  This script or discussion may require slight adjustments before it applies directly to newer builds.<\/i>]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are in the process of cleaning up our Cmdlets and ensuring that they are consistent.&nbsp; One of the things we want to do is the ensure that we provide Aliases for ParameterNames.&nbsp; As a general rule, parameternames are not pithy.&nbsp; That is great for reading scripts but can be a pain during interactive sessions.&nbsp; [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10581","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>We are in the process of cleaning up our Cmdlets and ensuring that they are consistent.&nbsp; One of the things we want to do is the ensure that we provide Aliases for ParameterNames.&nbsp; As a general rule, parameternames are not pithy.&nbsp; That is great for reading scripts but can be a pain during interactive sessions.&nbsp; [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/10581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=10581"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/10581\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=10581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=10581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=10581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}