none
error when trying autodiscoverurl with powershell RRS feed

  • Question

  • Hello,

    I am new to Powershell, but already trained a bit. I am totally new to EWS. We just outsourced our email onto an Exchange Server 2010 SP1. I want to interact with calendar objects; according to my available skills, EWS through Powershell seems to be the good solution.

    I am running my powershell commands on windows 7.

    I followed instructions found in various places, and have trouble with the AutodiscoverURL (we have a CNAME, suggested by our provider) : here is what I am doing :

    Import-Module -Name "C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll"

    $exchService = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP1)

    $exchService.UseDefaultCredentials = $true

    $exchService.AutodiscoverUrl("administrator@cedrat.com", {$true})


    as a result, I always get the same error (even with EWS API 1.2) :

    Exception calling "AutodiscoverUrl" with "2" argument(s): "The Autodiscover service couldn't be located."
    At line:1 char:29
    + $exchService.AutodiscoverUrl <<<< ("administrator@cedrat.com", {$true})
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException

    can anybody help me here ?

    Regards

    R. Grasso


    Thursday, March 21, 2013 10:36 AM

All replies

  • I'm sorry, I just messed up with the authentications ! my bad !
    Thursday, March 21, 2013 3:15 PM
  • Usually it happens because certificate validation failed, you can ignore validation by using the following line:  System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

    Monday, November 30, 2015 12:56 PM