Created
July 1, 2016 17:18
-
-
Save gerane/10c286bdbff1b8ce72578ed7b40fdc3b to your computer and use it in GitHub Desktop.
Just adding <# #> allows Get-Help to see the parameter attribute help. Removing <# #> breaks Help even if the parameter attributes are present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-WildCardsWorks | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$true, | |
Position=0, | |
ParameterSetName="Path", | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true, | |
HelpMessage="Path to one or more locations.")] | |
[SupportsWildcards()] | |
[PSDefaultValue(Help='*')] | |
[ValidateNotNullOrEmpty()] | |
[string[]]$Path = '*', | |
[Parameter(Mandatory=$false, Position=1)] | |
[SupportsWildCards()] | |
[PSDefaultValue(Help='*')] | |
[String[]]$Name ="*" | |
) | |
Begin | |
{ | |
} | |
Process | |
{ | |
$path | Where-Object { $_.Fullname -like 'test' } | |
} | |
End | |
{ | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME | |
Test-WildCardsFails | |
SYNTAX | |
Test-WildCardsFails [-Path] <string[]> [[-Name] <string[]>] [<CommonParameters>] | |
PARAMETERS | |
-Name <string[]> | |
Required? false | |
Position? 1 | |
Accept pipeline input? false | |
Parameter set name (All) | |
Aliases None | |
Dynamic? false | |
-Path <string[]> | |
Path to one or more locations. | |
Required? true | |
Position? 0 | |
Accept pipeline input? true (ByValue, ByPropertyName) | |
Parameter set name Path | |
Aliases None | |
Dynamic? false | |
<CommonParameters> | |
This cmdlet supports the common parameters: Verbose, Debug, | |
ErrorAction, ErrorVariable, WarningAction, WarningVariable, | |
OutBuffer, PipelineVariable, and OutVariable. For more information, see | |
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). | |
INPUTS | |
System.String[] | |
OUTPUTS | |
System.Object | |
ALIASES | |
None | |
REMARKS | |
None | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-WildCardsWorks | |
{ | |
<# | |
#> | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$true, | |
Position=0, | |
ParameterSetName="Path", | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true, | |
HelpMessage="Path to one or more locations.")] | |
[SupportsWildcards()] | |
[PSDefaultValue(Help='*')] | |
[ValidateNotNullOrEmpty()] | |
[string[]]$Path = '*', | |
[Parameter(Mandatory=$false, Position=1)] | |
[SupportsWildCards()] | |
[PSDefaultValue(Help='*')] | |
[String[]]$Name ="*" | |
) | |
Begin | |
{ | |
} | |
Process | |
{ | |
$path | Where-Object { $_.Fullname -like 'test' } | |
} | |
End | |
{ | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME | |
Test-WildCardsWorks | |
SYNTAX | |
Test-WildCardsWorks [-Path] <string[]> [[-Name] <string[]>] [<CommonParameters>] | |
PARAMETERS | |
-Name <string[]> | |
Required? false | |
Position? 1 | |
Accept pipeline input? false | |
Parameter set name (All) | |
Aliases None | |
Dynamic? false | |
-Path <string[]> | |
Path to one or more locations. | |
Required? true | |
Position? 0 | |
Accept pipeline input? true (ByValue, ByPropertyName) | |
Parameter set name Path | |
Aliases None | |
Dynamic? false | |
<CommonParameters> | |
This cmdlet supports the common parameters: Verbose, Debug, | |
ErrorAction, ErrorVariable, WarningAction, WarningVariable, | |
OutBuffer, PipelineVariable, and OutVariable. For more information, see | |
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). | |
INPUTS | |
System.String[] | |
OUTPUTS | |
System.Object | |
ALIASES | |
None | |
REMARKS | |
None | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment