PowerShell,Exchange 2010通讯簿

问题描述 投票:1回答:2

可以从客户端上运行的PowerShell脚本访问Exchange 2010通讯簿吗?我想访问地址簿,按属性搜索并使用结果。

我还没有找到任何EWS和PowerShell的教程。

[Reflection.Assembly]::LoadFrom("path to ews.dll")


$ExchangeService = new-object ExchangeServiceBinding

$paramName = New-Object UserConfigurationNameType
$paramName.Item = New-Object FolderIdType
$paramName.Name = "CategoryList"

$params = New-Object GetUserConfigurationType
$params.UserConfigurationName = $paramName
$params.UserConfigurationProperties = [UserConfigurationPropertyType]::ALL


$ExchangeService.UseDefaultCredentials
$ExchangeService.Url = "https://path.to.exchange/EWS/Exchange.asmx"
$ExchangeService.GetUserConfiguration($params)
powershell exchange-server powershell-v2.0 directoryservices
2个回答
1
投票

您需要Exchange EWS托管API:

http://msdn.microsoft.com/en-us/library/dd637749.aspx


2
投票

我不了解PowerShell,但您可以在Exchange命令行管理程序(EMC)中完成此操作。 PowerShell v2.0 +可以运行远程会话,因此可以从客户端使用EMC命令。当然,他们需要一些Exchange权限来执行此操作。在Exchange 2010中,RBAC可以方便地为您的用户提供微不足道的Exchange权限。如果这不是一个选项,你可以做一个LDAP查询(这是Outlook所做的),但我不确定具体的过程。


但是,如果是一个选项:

1. Initiate your remote PowerShell session.  
1a. $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionURI http://FQDNofCAS/PowerShell/ -Authentication Kerberos  
1b. Import-PSSession $session

之后,尝试以下之一:

1. Get-GlobalAddressList  
1b. Note the GAL you'll be using  
2. $GAL = (Get-GlobalAddressList "Default Global Address List").DistinguishedName  
2b. Replace _Default GAL_ with the output of step one.  
3. Get-GlobalAddressList $GAL | Update-GlobalAddressList  
4. Get-Recipinet -Filter {Addresslistmembership -eq $GAL}
4b. -Filter may require some tweaking to your specifics.  

注意:有关此问题的更好解释,请参阅http://www.msexchange.org/articles_tutorials/exchange-server-2007/management-administration/address-lists-exchange-2007-part1.html

- 要么 -

1. Get-User | where($_.RecipientType -like "*Mail*"}  

注意:这将显示所有已启用邮件的用户,因此可能不是您正在寻找的用户。

© www.soinside.com 2019 - 2024. All rights reserved.