기억이 지금까지 같이 $ PSBoundParameters 단지 $ MyInvocation.BoundParameters에 대한 바로 가기입니다 : $ MyInvocation.BoundParameters.Equals ($ PSBoundParameters) 진정한
당신이 cmdlet의 동일한 정보를 얻고 싶다면 그 을 당신은은 당신이 좋아하는 그 ... 그것을 얻을 수 썼다 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management.Automation;
namespace Test
{
[Cmdlet(VerbsCommon.Get, "WhatIf", SupportsShouldProcess = true)]
public class GetWhatIf : PSCmdlet
{
// Methods
protected override void BeginProcessing()
{
this.WriteObject(this.MyInvocation.BoundParameters.ContainsKey("WhatIf").ToString());
}
}
}
코드는 quick'n'dirty,하지만 당신은 사진을 찍어해야한다. 면책 조항 : 저는 개발자가 아니므로 아마 잘못했을 것입니다. ;)
HTH Bartek
필요도 고려해야 할 ['InvocationInfo.UnboundParameters'] (http://msdn.microsoft.com/en-us/library/windows/desktop/system.management. 매개 변수가 'ValueFromRemainingArguments' true 인 경우) 매개 변수에 바인딩되지 않은 모든 매개 변수에 대해 (예 : automation.invocationinfo.unboundarguments % 28v = vs.85 % 29.aspx). – Richard