What is reason for Exception: value cannot be null. Parameter name: serverSettingsValue for exchange 2010 powershell command RRS feed

  • Question

  • I am trying to execute powershell command


    from C# code.

     When my C# project is complied in .NET 3.5 then no exceptions are thrown

    But when same project is compiled in .NET 4.0 this error message getting thrown.

     Value cannot be null.
    Parameter name: serverSettings ---> System.ArgumentNullException: Value cannot b
    e null.
    Parameter name: serverSettings
       at Microsoft.Exchange.Configuration.Tasks.TaskVerboseStringHelper.GetADServer
    Settings(String cmdletName, ADServerSettings serverSettings)
       at Microsoft.Exchange.Configuration.Tasks.Task.LogCmdletIterationEvent()
       at Microsoft.Exchange.Configuration.Tasks.Task.BeginProcessing()
       at System.Management.Automation.Cmdlet.DoBeginProcessing()
       at System.Management.Automation.CommandProcessorBase.DoBegin()
       --- End of inner exception stack trace ---
       at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable inp
       at System.Management.Automation.Runspaces.Pipeline.Invoke()
       at Exchange2010.Program.Main(String[] args)

     This C# application  is executed on exchange server itself not from remote machine. Exchange server has all .NET version installed from 1.1 to 4.0.
    I thought i have to add app.config file so i have updated project config file with these 2 lines 

    <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0"/>

    But no luck. 
    Any one know why .NET 4.0 is causing problem  for Exchange 2010 cmdlets ?
    .Net 4.0 is installed after installing Exchange.

    From Exchange Management shell I am able to execute this command but not from C# app.
    Exchange 2010 has SP3 installed.
    Friday, April 19, 2013 11:39 AM

All replies

  • Did you ever figure this out?  I am experiencing this problem as well and haven't figured out a solution yet. Well, other than using .Net 3.5, that is.
    Thursday, December 5, 2013 4:47 PM