In PowerShell 4.0 you can hide a parameter using the ParameterAttribute.DontShow property. That said, the parameter is hidden only from tab completion (PowerShell Magazine tip).
How to hide a parameter in Cmdlet
-
04-07-2022 - |
Pergunta
I want to hide a PowerShell Cmdlet parameter from user. Is there any way to do this in C#?
I want to use this parameter within my code to trigger the same cmdlet with the hidden parameter.
I use PowerShell 2.0.
Thanks.
Solução
Outras dicas
If you can't find a way to hide the parameter (e.g. from Get-Help) you can "hide" it in plain sight by using a common parameter that it's unlikely a user would ever specify, like -OutBuffer 0, and test for the presence of that in PSBoundParameters.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow