邮件服务器-邮件系统-邮件技术论坛(BBS)

 找回密码
 会员注册
查看: 4389|回复: 1
打印 上一主题 下一主题

如何在目录中查找邮箱的GUID

[复制链接]
跳转到指定楼层
顶楼
发表于 2005-12-16 10:25:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
msExchMailboxGUID ?
沙发
 楼主| 发表于 2005-12-16 13:40:38 | 只看该作者

搞好了,发出来大家共享!

'===============================================================<br>
' Purpose: Display each Exchange_Mailbox found for Exchange server,<br>
' and show the MailboxGUID property on the Exchange_Mailbox<br>
' objects<br>
' Change: cComputerName [string] the computer to access<br>
' Output: Displays the name of each Exchange_Mailbox's MailboxGUID property<br>
'===============================================================<br>
<br>
On Error Resume Next<br>
Dim cComputerName<br>
Const cWMINameSpace = "root/MicrosoftExchangeV2"<br>
Const cWMIInstance = "Exchange_Mailbox"<br>
cComputerName = "YourComputerNameofExchange"<br>
<br>
Dim strWinMgmts ' Connection string for WMI<br>
Dim objWMIExchange ' Exchange Namespace WMI object<br>
Dim listExchange_Mailboxs ' ExchangeLogons collection<br>
Dim objExchange_Mailbox ' A single ExchangeLogon WMI object<br>
<br>
' Create the object string, indicating WMI (winmgmts), using the<br>
' current user credentials (impersonationLevel=impersonate),<br>
' on the computer specified in the constant cComputerName, and<br>
' using the CIM namespace for the Exchange provider.<br>
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//"& _<br>
cComputerName&"/"&cWMINameSpace<br>
Set objWMIExchange = GetObject(strWinMgmts)<br>
' Verify we were able to correctly set the object.<br>
If Err.Number <> 0 Then<br>WScript.Echo "ERROR: Unable to connect to the WMI namespace."<br>
Else<br>'<br>' The Resources that currently exist appear as a list of<br>' Exchange_Mailbox instances in the Exchange namespace.<br>Set listExchange_Mailboxs = objWMIExchange.InstancesOf(cWMIInstance)<br>'<br>' Were any Exchange_Mailbox Instances returned?<br>If (listExchange_Mailboxs.count > 0) Then<br>' If yes, do the following:<br>' Iterate through the list of Exchange_Mailbox objects.<br>For Each objExchange_Mailbox in listExchange_Mailboxs<br>Wscript.Echo"MailUserName = "&objExchange_Mailbox.MailboxDisplayName<br>'<br>' Display the value of the MailboxGUID property.<br>WScript.echo "MailboxGUID = "& _<br>" ["&TypeName(objExchange_Mailbox.MailboxGUID)&"] "& _<br>objExchange_Mailbox.MailboxGUID<br>'<br>Next<br>Else<br>' If no Exchange_Mailbox instances were returned,<br>' display that.<br>WScript.Echo "WARNING: No Exchange_Mailbox instances were returned."<br>End If<br>
End If<br>
<br>
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

小黑屋|手机版|Archiver|邮件技术资讯网

GMT+8, 2026-8-6 02:21

Powered by Discuz! X3.2

© 2001-2016 Comsenz Inc.

本论坛为非盈利中立机构,所有言论属发表者个人意见,不代表本论坛立场。内容所涉及版权和法律相关事宜请参考各自所有者的条款。
如认定侵犯了您权利,请联系我们。本论坛原创内容请联系后再行转载并务必保留我站信息。此声明修改不另行通知,保留最终解释权。
*本论坛会员专属QQ群:邮件技术资讯网会员QQ群
*本论坛会员备用QQ群:邮件技术资讯网备用群

快速回复 返回顶部 返回列表