Problem with My Function’s Comments

by GuyThomas at 2013-04-05 05:57:53

Problem with My Function’s Comments
Question: What am I doing wrong?

This is how I produce the problem:
Get-Help Get-WmiClass –Full

What’s wrong:
Position = 1 [Should be zero]
No mention of Aliases See below

-Class <String>

Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false [/quote]

Bizarre Solutions
Adding this in the comments section <#
Even more bizarre solution adding
Both solution produce the desired results: Position = 0, and Aliases

My question what am I doing to cause this behaviour?
-Class <string>

Required? false
Position? 0
Accept pipeline input? false
Parameter set name (All)
Aliases classic
Dynamic? false [/quote]
Here is the first half of my function.

[quote]Function Global:Get-WmiClass {
A function to list WMI classes

Contains switches to filter for network WMI classes

Get-WMIClass -Network

Param (
Position = 0 )]
[String]$Class ="",
) [/quote]
by MasterOfTheHat at 2013-04-05 07:43:59
From the about_Function_Advanced_Parameters help page:
NOTE: When the Get-Help cmdlet displays the corresponding “Position?” parameter
attribute, the position value is incremented by 1. For example, a parameter
with a Position argument value of 0 has a parameter attribute of
"Position? 1."

So that answers the question about making it show up as “Position = 0” vs “Position = 1”. And I think that parameter aliases are not shown in Get-Help output…