현재 ASP.NET MVC 웹 사이트에서 일부 Exchange 2010 작업을 자동화하는 응용 프로그램을 작성 중입니다.PowerShell ParameterBindingException
지금 New-AddressList 명령을 호출하려고하면 ParameterBindingException이 발생합니다.
나는 (어떤 작품) 다음 전화를 만들기 위해 노력하고 있어요 :
new-AddressList -Name "7 AL" -RecipientContainer "myDomain.local/Customers/7" -IncludedRecipients 'AllRecipients' -Container '\' -DisplayName "7 AL"
내가 다음으로 그 일을하고있다 :
var NewAddressList = new Command("New-AddressList");
NewAddressList.Parameters.Add("Name", "7 AL");
NewAddressList.Parameters.Add("RecipientContainer", "myDomain.local/Customers/7");
NewAddressList.Parameters.Add("IncludedRecipients", "AllRecipients");
NewAddressList.Parameters.Add("Container", @"\");
NewAddressList.Parameters.Add("DisplayName", "7 AL");
CommandsList.Add(NewAddressList);
이 commandlist 내가 호출 파이프 라인에 제공되고, 다음 오류를 내게 :
새 주소 목록 : 입력 개체는 명령에 대한 매개 변수에 바인딩 할 수 없습니다.이 명령은 파이프 라인 입력 또는 입력 및 해당 속성이 파이프 라인 입력을받는 매개 변수와 일치하지 않습니다.
- CategoryInfo : InvalidArgument (7 : PSObject) 새로운-AddressList를, ParameterBindingException
- FullyQualifiedErrorId : InputObjectNotBound, Microsoft.Exchange.Management.SystemConfigurationTasks.NewAddressList 가 발생할 수 있습니다 무엇에 대한 모든 단서
이? 추적-명령과
출력 제공 :
PS C:\Users\ext_kefu> Trace-Command -Name parameterbinding -Expression {New-AddressList -Name "7 AL" -RecipientContainer "myDomain.local/Customers/7" -IncludedRecipients 'AllRecipients' -Container '\' -DisplayName "7 AL"} -PSHost
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [New-AddressList]
DEBUG: ParameterBinding Information: 0 : BIND arg [7 AL] to parameter [Name]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.String]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : BIND arg [7 AL] to param [Name] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [myDomain.local/Customers/7] to parameter [RecipientContainer]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter]
DEBUG: ParameterBinding Information: 0 : Trying to convert argument value from System.String to Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter
DEBUG: ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [myDomain.local/Customers/7]
DEBUG: ParameterBinding Information: 0 : BIND arg [myDomain.local/Customers/7] to param [RecipientContainer] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [AllRecipients] to parameter [IncludedRecipients]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.Nullable[Microsoft.Exchange.Data.Directory.Recipient.WellKnownRecipientType]]
DEBUG: ParameterBinding Information: 0 : Trying to convert argument value from System.String to System.Nullable[Microsoft.Exchange.Data.Directory.Recipient.WellKnownRecipientType]
DEBUG: ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [AllRecipients]
DEBUG: ParameterBinding Information: 0 : BIND arg [AllRecipients] to param [IncludedRecipients] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [\] to parameter [Container]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [Microsoft.Exchange.Configuration.Tasks.AddressListIdParameter]
DEBUG: ParameterBinding Information: 0 : Trying to convert argument value from System.String to Microsoft.Exchange.Configuration.Tasks.AddressListIdParameter
DEBUG: ParameterBinding Information: 0 : CONVERT arg type to param type using LanguagePrimitives.ConvertTo
DEBUG: ParameterBinding Information: 0 : CONVERT SUCCESSFUL using LanguagePrimitives.ConvertTo: [\]
DEBUG: ParameterBinding Information: 0 : BIND arg [\] to param [Container] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [7 AL] to parameter [DisplayName]
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.String]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : BIND arg [7 AL] to param [DisplayName] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [New-AddressList]
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [New-AddressList]
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing
Name DisplayName RecipientFilter
---- ----------- ---------------
7 AL 7 AL Alias -ne $null
답변 해 주셔서 감사합니다.불행히도, 아무 것도 바뀌지 않았습니다. var-thing은 단지 습관 일뿐입니다. Powershell 클래스의 래퍼가있어서 래퍼에 전달하는 Collection을 생성하고 있습니다. –
kfuglsang
명령이 powershell에서 작동하고 있습니까? 'Trace-Command'를 사용하여 트레이스를 얻을 수 있습니까? –
원본 질문을 추적 출력으로 업데이트했습니다. 명령이 올바르게 작동합니다. – kfuglsang