Actualmente estoy compilando una aplicación para automatizar algunas operaciones de Exchange 2010 desde un sitio web ASP.NET MVC.PowerShell ParameterBindingException
En este momento, me he encontrado con una ParameterBindingException cuando intento invocar el comando New-AddressList.
estoy tratando de crear la siguiente llamada (que trabaja):
new-AddressList -Name "7 AL" -RecipientContainer "myDomain.local/Customers/7" -IncludedRecipients 'AllRecipients' -Container '\' -DisplayName "7 AL"
lo estoy haciendo por lo siguiente:
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);
Este CommandList se proporciona a una tubería que invoco, dándome el siguiente error:
New-AddressList: El objeto de entrada no puede vincularse a ningún parámetro para el comando ya sea porque el comando no toma la entrada de la tubería o el la entrada y sus propiedades no coinciden con ninguno de los parámetros que toman entrada de canalización.
- CategoryInfo: InvalidArgument: (7: PSObject) [New-AddressList], ParameterBindingException
- FullyQualifiedErrorId: InputObjectNotBound, Microsoft.Exchange.Management.SystemConfigurationTasks.NewAddressList
Cualquier pistas sobre lo que podría causar ¿esta?
salida con Trace-Command da:
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
Gracias por su respuesta.Lamentablemente, no cambió nada. Lo var-thing es solo un hábito. Tengo un contenedor para la clase Powershell y, por lo tanto, estoy creando una Colección que paso a mi contenedor. –
kfuglsang
¿Estás seguro de que el comando funciona desde PowerShell? ¿Eres capaz de obtener una traza usando 'Trace-Command'? –
He actualizado la pregunta original con la salida de rastreo. El comando funciona correctamente. – kfuglsang