切换到宽版
  • 9673阅读
  • 1回复

[求助]合用脚本在所有邮箱搜索中搜索指定的邮箱 [复制链接]

上一主题 下一主题
 
只看楼主 倒序阅读 0楼  发表于: 2011-03-10
— 本帖被 YOYO 从 Exchange 脚本中心 移动到本区(2015-06-25) —
  • 脚本环境:Visual Basic
  • 适合版本:Exchange 2003
  • 适用平台:
使用些脚本可以帮助你在所的邮箱存储中搜索到指定的邮箱。

<html>
<!--
Coded by Dave!
Created:  17 Sep 2005
This script searches all the stores in an Exchange server for a specific Mailbox.
Searches in Exchange via Script are Case Sensitive!  You'll have to make sure
to type the information exactly as it would appear in the Display Name of the
mailbox.
Our Policy has the Display Name formated with Lastname first.

-->
<head>
<title>Another Deleted Mailbox!</title>
<HTA:APPLICATION
     ID="deletedMailbox"
     APPLICATIONNAME="Finding Deleted Mailboxes"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
     MAXIMIZEBUTTON="no"
     MINIMIZEBUTTON="no"
     >
</head>

<script Language = "VBScript">
ON ERROR RESUME NEXT

Sub Window_Onload
self.MoveTo 10,10
self.ResizeTo 600,800
End Sub

'Modify this list with the addition or removal of mailbox servers or Domains.
'Entries should have no spaces and be separated by a semi-colon - ;
domain1 = "Mail1"
domain2 = "Mail1;Mail2;Mail3"


SUB chosenDomain
mailboxtitle.InnerHTML = "Searching for the Mailbox.  Hold on buddy!"
mailboxes.InnerHTML = "<BR>"
strMailbox = ""
strAccounts = ""
If chooseDomain.Value = "domain1" then Servers = split(domain1,";")
If chooseDomain.Value = "domain2" then Servers = split(domain2,";")

ExchangeInfo lookforme.Value, Servers
end SUB

SUB ExchangeInfo (strSN,strComputer)
for t=0 to uBound(strComputer)
mailboxes.InnerHTML = "Now Looking in server " & strComputer(t)
Set objWMIService = GetObject("winmgmts:"  & _
    "{impersonationLevel=impersonate}!\\" & strComputer(t) & "\ROOT\MicrosoftExchangeV2")
strQuery = "SELECT * FROM Exchange_Mailbox"
Set colItems = objWMIService.ExecQuery (strQuery)

For Each objItem in colItems
  If (InStr(objItem.MailboxDisplayName ,strSN) > 0 ) Then
    If objItem.DateDiscoveredAbsentInDS <> "" then
      strMailbox = strMailbox & "<font color = red>" & objItem.StoreName
      strMailbox = strMailbox & "  ---  " & objItem.MailboxDisplayName & "</font><br><hr>"
    else
      strMailbox = strMailbox &  objItem.StoreName & "  ---  " & objItem.MailboxDisplayName & "<BR><hr>"
    end if
  End If
Next
mailboxtitle.InnerHTML = "Mailboxes in <font color=red>RED</font> are tombstoned.<br><hr width=95%><br>"
mailboxes.InnerHTML =  strMailbox
next
set objWMIService = nothing
END Sub
</script>

<body bgcolor=white text=black>
<table width=100% height=100%>
<tr height=5%><td bgcolor=darkblue align=center valign=center>
<font color=white>
<h2 align=center>Where's that mailbox?</h2>
</font><br>
</td></tr>
<tr><td><br>
Information entered is <strong>Case Sensitive</strong> and must match the Display Name.<br>
(ie:  Lastname Firstname, or Lastname, or Firstname)<br>
<span id='root'>
<select size='1' name='chooseDomain'>
<option value='domain1'>Domain 1</option>
<option value='domain2'>Domain 2</option>
</select>
<input type='text' name='lookforme'>
<input type='button' value='Find me!' onClick='chosenDomain'><br>

<table width=100% height=80% align=center>
<tr height=10%>
<td colspan=3 align=center valign=top><br><span id='mailboxtitle'></span>
</td>
</tr>
<tr>
<td></td>
<td width=90% align=left valign=top>
<span id='mailboxes'></span>
</td>
<td></td>
</tr>
</table>
</span>
</td></tr>
</table>
</body>
</html>
分享到
只看该作者 1楼  发表于: 2014-02-13
感谢分享天津窗帘
快速回复
限60 字节
 
上一个 下一个