Quantcast
Channel: Exchange Server 2010 forum
Viewing all articles
Browse latest Browse all 8820

scripting agent not working :(

$
0
0

Hi all

I am currently trying to disable ActiveSync by default when creating new users

Here is my scriptingagentconfig.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<Configuration version="1.0">
<Feature Name="MailboxProvisioning" Cmdlets="new-mailbox">
 <ApiCall Name="OnComplete">
 if($succeeded) {
  start-sleep -s 10
  $DC = [string]($readOnlyIConfigurable.originatingserver)
  $newmailbox = $provisioningHandler.UserSpecifiedParameters["Name"]
  set-casmailbox $newmailbox -activesync $false
 }
 </ApiCall>
</Feature>
</Configuration>

Here is the error:

Summary: 1 item(s). 1 succeeded, 0 failed.
Elapsed time: 00:00:11


Ronnie5 Test5
Completed

Warning:
The cmdlet extension agent with the index 5 has thrown an exception in OnComplete(). The exception is: Microsoft.Exchange.Provisioning.ProvisioningException: ScriptingAgent: Exception thrown while invoking scriptlet for OnComplete API: Cannot bind parameter 'ActiveSyncMailboxPolicy'. Cannot convert value "False" to type "Microsoft.Exchange.Configuration.Tasks.MailboxPolicyIdParameter". Error: "Invalid cast from 'System.Boolean' to 'Microsoft.Exchange.Configuration.Tasks.MailboxPolicyIdParameter'.". ---> System.Management.Automation.ParameterBindingException: Cannot bind parameter 'ActiveSyncMailboxPolicy'. Cannot convert value "False" to type "Microsoft.Exchange.Configuration.Tasks.MailboxPolicyIdParameter". Error: "Invalid cast from 'System.Boolean' to 'Microsoft.Exchange.Configuration.Tasks.MailboxPolicyIdParameter'." ---> System.Management.Automation.PSInvalidCastException: Cannot convert value "False" to type "Microsoft.Exchange.Configuration.Tasks.MailboxPolicyIdParameter". Error: "Invalid cast from 'System.Boolean' to 'Microsoft.Exchange.Configuration.Tasks.MailboxPolicyIdParameter'." ---> System.InvalidCastException: Invalid cast from 'System.Boolean' to 'Microsoft.Exchange.Configuration.Tasks.MailboxPolicyIdParameter'.
   at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
   at System.Boolean.System.IConvertible.ToType(Type type, IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at System.Management.Automation.LanguagePrimitives.ConvertIConvertible(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
   --- End of inner exception stack trace ---
   at System.Management.Automation.LanguagePrimitives.ConvertIConvertible(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
   at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursion, IFormatProvider formatProvider, TypeTable backupTypeTable)
   at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, IFormatProvider formatProvider)
   at System.Management.Automation.ParameterBinderBase.CoerceTypeAsNeeded(CommandParameterInternal argument, String parameterName, Type toType, ParameterCollectionTypeInformation collectionTypeInfo, Object currentValue)
   --- End of inner exception stack trace ---
   at System.Management.Automation.ParameterBinderBase.CoerceTypeAsNeeded(CommandParameterInternal argument, String parameterName, Type toType, ParameterCollectionTypeInformation collectionTypeInfo, Object currentValue)
   at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
   at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
   at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
   at System.Management.Automation.CmdletParameterBinderController.BindParameters(UInt32 parameterSets, Collection`1 arguments, CommandMetadata commandMetadata)
   at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments)
   at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
   at System.Management.Automation.CommandProcessor.BindCommandLineParameters(CommandParameterInternal[] parameters)
   at System.Management.Automation.CommandProcessor.Prepare(CommandParameterInternal[] parameters)
   at System.Management.Automation.CommandProcessorBase.DoPrepare(CommandParameterInternal[] parameters)
   at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
   --- End of inner exception stack trace ---
   at Microsoft.Exchange.ProvisioningAgent.ScriptingAgentHandler.OnComplete(Boolean succeeded, Exception e)
   at Microsoft.Exchange.Provisioning.ProvisioningLayer.OnComplete(Task task, Boolean succeeded, Exception exception)

Exchange Management Shell command completed:
New-Mailbox -Name 'Ronnie5 Test5' -Alias 'Ronnie5' -UserPrincipalName 'Ronnie5@ad.DNSArrow.co.uk' -SamAccountName 'Ronnie5' -FirstName 'Ronnie5' -Initials '' -LastName 'Test5' -Password 'System.Security.SecureString' -ResetPasswordOnNextLogon $false -Database 'DB01'

Elapsed Time: 00:00:11

Any ideas?


Regards
ronnie.jorgensen systems engineer
My blog


Viewing all articles
Browse latest Browse all 8820

Trending Articles