0

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

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

是否可以以编程方式监控此交换服务,以便在它出现故障时警告用户?我知道“正确”的解决方案是让 Exchange 团队处理这个问题,但是由于时区差异(以及他们的巨大工作量),我真的需要从头开始处理它。

你能用 WebDav 做这样的事情吗?

4

1 回答 1

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
  }
于 2010-02-09T04:54:57.313 回答