In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This script is shared by the buddies in the group, and I specially sort it out and share it with the students in need.
Note:
1. Modify some of the parameters before use (the original author has been intimately marked)
two。 Modify the execution strategy of the script if necessary
Screenshot of the effect:
Screenshots of scheduled tasks:
Content of the script:
Add-pssnapin microsoft.exchange* # load EMS or the exchange command will not recognize
$Smtp= "mail.demo.com" # what needs to be modified $AdminEamil= "zhangdl@demo.com,zhangsan@demo.com" # what needs to be modified br/ > $AdminEamil= "zhangdl@demo.com,zhangsan@demo.com" # what needs to be modified
$iTun0
$Searcher = Get-MailboxDatabase | Get-MailboxDatabaseCopyStatus
$bordercolor ='# eee'
$I = 0
Foreach ($Sear in $Searcher)
{
# $MailDB = Get-MailboxDatabase-Identity $Sear.Databasename
$sem = 'none'
$bgindex =''
$trbgcolor =''
$errmess =''
# determine the copy and load status of the library
If ($Sear.Status-eq 'Healthy')
{$SStatus = 'replication normal' # status, such as mounted
$bordercolor ='# efefef'
}
Elseif ($Sear.Status-eq 'Suspended')
{
$SStatus = 'shelved'
$bordercolor ='# FFFFCC'
}
Elseif ($Sear.Status-eq 'Failed')
{
$SStatus = 'failed'
$bordercolor ='# FF0000'
}
Elseif ($Sear.Status-eq 'Mounted')
{
$SStatus = 'mounted'
$bordercolor ='# ffffff'
}
Elseif ($Sear.Status-eq 'Dismounted')
{
$SStatus = 'uninstalled'
$bordercolor ='# ffcc00'
}
Elseif ($Sear.Status-eq 'ServiceDown')
{
$SStatus = 'Service stop'
$bordercolor ='# FF0000'
}
Else
{
$SStatus = $Sear.Status
}
# determine the status of the content index
If ($Sear.ContentIndexState-eq 'Healthy')
{
$SConIndexState = 'normal'
}
Elseif ($Sear.ContentIndexState-eq 'Failed')
{
$SConIndexState = 'failed'
$bgindex ='# ff0000'
}
Else
{
$SConIndexState = $Sear.ContentIndexState
$bgindex ='# ff0000'
}
# judge whether there is an error
If ($Sear.ErrorMessage.length-gt 0)
{
$I = $iTun1
$sem = 'error code 00 / 2 / I
$errmess = $Sear.ErrorMessage
$errmes + = "
$sem
$errmess "
}
# determine whether it is the main library or not
If ($Sear.ActiveCopy-eq $true)
{
$sac = 'Yes'
}
Else
{
$sac ='No'
$trbgcolor = 'background-color:#efefef'
}
$mbs = $Sear.MailboxServer
$sdn = $Sear.DatabaseName
$scql = $Sear.CopyQueueLength
$srql = $Sear.ReplayQueueLength
$seei = $Sear.ErrorEventId $OutDB + = "$mbs$sdn $SStatus $SConIndexState $scql $srql $sac $sem $seei
"
}
$Output = "
Exchange database running status report
Generation time $((Get-Date) .ToString ())
Server name
Database name
Status
Content index status
Replication queue length
Replay queue length
Whether it is an active library
Error message
Error event ID
$OutDB
Error codes and error messages
Error code
Error content
$errmes
"
Function sendmail ($body)
{
$today = Get-Date
$SmtpClient = new-object system.net.mail.smtpClient
$mailmessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = $Smtp$mailmessage.from = $EmailSender$mailmessage.To.add ($AdminEamil) $mailmessage.Priority= [system.net.mail.MailPriority]:: High $mailmessage.Bcc.add ("zhangdl@qunar.com") # need to modify $mailmessage.Subject = "[Report] Exchange database running status report" $mailmessage.IsBodyHtml = $true$mailmessage.Body + = "`n" + $body$smtpclient.Send ($mailmessage)
}
Sendmail $Output
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.