문제

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.

도움이 되었습니까?

해결책

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).

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top