如何从我的应用程序监视Exchange 2003事件服务?

时间:2010-02-01 02:35:29

标签: exchange-server exchange-server-2003

我们的服务器人员在Exchange上设置了一些内容,以便对于特定的电子邮件地址,发送给它的任何附件都将被转储到文件服务器上的某个位置。

Exchange事件服务控制此行为,但似乎此特定服务经常失败。我不知道为什么 - 我没有访问Exchange服务器,它由不同国家的团队运行。

是否可以以编程方式监控此交换服务,以便我可以警告用户是否出现故障?我知道“正确”的解决方案是由Exchange团队处理,但由于时区差异(及其庞大的工作量),我真的需要从最终处理它。

你能用WebDav做这样的事吗?

1 个答案:

答案 0 :(得分:0)

您可以使用以下powerShell脚本:

# Getting status of Exchange Services and look for anything that's "stopped"
$ServiceStatus = get-service MSExch* | where-object {$_.Status -eq "stopped"}

# Convert Result to String
$ServiceStatusText = $ServiceStatus | fl | Out-String

# If $ServiceStatus <> $null then send notification
If ($ServiceStatus -ne $null)
 {
 ###Exchange Server Values
 $FromAddress = "Exchange-Alert@YOUR_DOMAIN.local"
 $ToAddress = "your_address@YOUR_DOMAIN.com"
 $MessageSubject = "CRITICAL: An exchange service is has stopped"
 $MessageBody = "One or more Exchange services has stopped running or crashed. Please check the server ASAP for possible issues`n"
 $MessageBody = $MessageBody + $ServiceStatusText

 $SendingServer = "msexch02.pnlab.local"

 ###Create the mail message and add the statistics text file as an attachment
 $SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody

 ###Send the message
 $SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
 $SMTPClient.Send($SMTPMessage)
}

# Else don't do anything and exit
Else
  {
  $null
  }