|
使用脚本,获取MAPI属性,根据网上的脚本修改后如下:
servername = "172.18.2.243"
PR_NTSDModificationTime = &H3FD60040
Set fso = CreateObject("Scripting.FileSystemObject")
set wfile = fso.opentextfile("c:\mbCreationTime.csv",2,true)
wfile.writeline("Mailbox,CreationTime")
Const ADS_SCOPE_SUBTREE = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select name,mail from 'LDAP://OU=The9,DC=PD,DC=the9,DC=com'Where objectClass='user'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
UserName = objRecordSet.Fields("Name").Value
UserMail = objRecordSet.Fields("Mail").Value
If isNull(UserMail) = True Then
Else
Call procmailboxes(servername,UserMail)
End If
objRecordSet.MoveNext
Loop
Wscript.Echo "Done.."
sub procmailboxes(servername,MailboxAlias)
Set msMapiSession = CreateObject("MAPI.Session")
on error Resume next
msMapiSession.Logon "","",False,True,True,True,Servername & vbLF & MailboxAlias
if err.number = 0 then
on error goto 0
Set objInbox = msMapiSession.Inbox
Set objInfostore = msMapiSession.GetInfoStore(objInbox.StoreID)
Set objRootFolder = objInfostore.Rootfolder
Set Non_IPM_rootFolder = msMapiSession.GetFolder(objRootfolder.fields.item(&h0E090102),objInfoStore.ID)
wfile.writeline(UserName & "," & Non_IPM_rootFolder.fields.item(PR_NTSDModificationTime))
else
wfile.writeline(UserName & "," & "Error Opening Mailbox")
end if
Set msMapiSession = Nothing
Set mrMailboxRules = Nothing
End Sub
注意以下步骤:
1. 不要用Administrator测试,因为MailBox的Full Control对Administrator是Deny的.
所以,新建一个普通user,然后在Exchange“系统管理器”里,添加对Exchange Server的Full Control权限.
2. 更改脚本:
a. 修改第一行的ServerName,这里用Exchange Server的IP地址或者NetBios Name。
b. 修改LDAP位置,“LDAP://OU=The9,DC=PD,DC=the9,DC=com”修改为自己的LDAP信息。
3. 双击脚本运行。
请测试了看看,如果有问题,请提出.. |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?会员注册
x
评分
-
查看全部评分
|