我正在寻找一种方法来列出在Exchange 2003中设置任何传递选项的帐户。
我已经使用WMI来查询在http://msdn.microsoft.com/en-us/library/aa142577(EXCHG.65).aspx上描述的Exchange类,但到目前为止,我还没有find与交付选项相关的任何属性。
谢谢!
您需要更具体地指定您想要的交付选项,因为有几个选项。 不过,我会给你这个VBScript,它会给你所有Active Directory中有转发邮箱的用户。
我已经在虚拟机中testing过了,运行速度非常快,但是通常的规则都适用。 请在实验环境中进行testing,然后再运行此脚本,我不承担责任。
在命令行上使用cscript /nologo altRecipient.vbs
'************************************************************************************ '* Script to find all users who have alternative recipients set '* '* This script was hacked together with information from the following sources. '* I make no claim of ownership to any part of this script '* '* - http://support.microsoft.com/kb/817433 '* - http://blogs.technet.com/b/heyscriptingguy/archive/2006/03/22/how-can-i-get-a-list-of-all-the-users-who-have-an-alternate-recipient.aspx '************************************************************************************ Dim sDomain, sADsPath, sPDC Dim oCon ,oCmd, oRst Set oRst = CreateObject("ADODB.Recordset") Set oCmd = CreateObject("ADODB.Command") Set oCon = CreateObject("ADODB.Connection") Dim oRoot, oDomain, oADInfo, oInfo Set oADInfo = CreateObject("ADSystemInfo") Set oInfo = CreateObject("WinNTSystemInfo") sPDC = oInfo.PDC & "." & oADInfo.DomainDNSName oCon.Provider = "ADSDSOObject" oCon.Open "Active Directory Provider" oCmd.ActiveConnection = oCon Set oRoot = GetObject("LDAP://rootDSE") sDomain = oRoot.Get("defaultNamingContext") Set oDomain = GetObject("LDAP://" & sDomain) sADsPath = "<" & oDomain.ADsPath & ">" oCmd.CommandText = "SELECT altRecipient, Name FROM 'LDAP://" & sPDC & "/" & sDomain & "' WHERE objectCategory='user' and altRecipient = '*'" Set oRst = oCmd.Execute If oRst.RecordCount = 0 Then WScript.Echo "no accounts found" WScript.Quit End If Do While Not oRst.EOF WScript.Echo "User " & oRst.Fields("Name") & " is forwarded to " & oRst.Fields("altRecipient") WScript.Echo "==========================================" oRst.MoveNext Loop