Got an error while trying to execute the following code:
$dll = "C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll"
import-module -Name $dll
$exc = new-object Microsoft.Exchange.WebServices.Data.ExchangeService
Error:
New-Object : Could not load file or assembly 'System.Core, Version=3.5.0.0, Cul
ture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The
system cannot find the file specified.
At D:\scripts\get_mails.ps1:5 char:18
+ $exc = new-object <<<< Microsoft.Exchange.WebServices.Data.ExchangeService
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundExce
ption
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerS
hell.Commands.NewObjectCommand
We ran this on a windows server 2008 r2 which has .net framework 4.5.2 (now upgraded to 4.6.1) installed. The version of powershell being used is v2.0
We should be able to use the managed api via powershell 2.0 right?