繁体   English   中英

PowerShell,Exchange 2010地址簿

[英]PowerShell, Exchange 2010 Addressbook

是否可以从客户端上运行的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命令行管理程序(EMC)中完成此操作。 PowerShell v2.0 +可以运行远程会话,因此可以从客户端使用EMC命令。 当然,他们需要一些交换权限才能执行此操作。 在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*"}  

注意:这将显示所有已启用邮件的用户,因此可能与您要找的不完全相同。

您需要Exchange EWS托管API:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM