Виктория тебе уже сказала, что винт сыпется (current pending sectors = 103 и reallocated event count = 15). С винтом все плохо, начни с его замены.
В этом разделе можно просмотреть все сообщения, сделанные этим пользователем.
Просмотр сообщений
Param(
[string]$From = 'alert@domain.net'
[string]$To = 'admin@domain.net'
[string]$Server = 'mail.domain.local'
[switch]$email = $true
)
[int]$WarningLevel = 10
[int]$CriticalLevel = 20
[int]$ResultError = 0
[string]$computername=$env:computername
function Send-EmailMessage {
param([string]$EmailSubj=$Results, [string]$EmailBody=$Results)
$EmailMessage.Subject = $EmailSubj
$EmailMessage.Body = $EmailBody
$SMTPClient.Send( $EmailMessage )
}
$isHubTransportServer=(Test-Path "HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\HubTransportRole")
if ($isHubTransportServer) {
$MessagesQueued=get-wmiobject -query "select MessagesQueuedForDelivery from Win32_PerfFormattedData_MSExchangeTransportQueues_MSExchangeTransportQueues"
$Messages=$MessagesQueued.MessagesQueuedForDelivery
$MRes=[string]$messages
if ($Messages) {
if ($Messages -lt $WarningLevel) {
$Results = 'Все в порядке. Количество сообщений в очереди на сервере '+$computername+': ' +$MRes.remove(2)
}
if ($Messages -gt $WarningLevel) {
$ResultError=1
$Results = 'Я извиняюсь, но количество сообщений в очереди на сервере '+$computername+': ' +$MRes.remove(2)+ ' и мне это не по нраву...'
}
if ($Messages -gt $CriticalLevel) {
$ResultError=2
$Results = 'Алярм!!! Что-то пошло не так, и количество сообщений в очереди на сервере '+$computername+' достигло: ' +$MRes.remove(2)+ '. Это меня тревожит...'
}
}
Else {
$ResultError=1
$Results = 'Внимание! Очередь сообщений НЕДОСТУПНА на сервере ' +$computername
}
}
Else {
$Results='Exchange 2013 не установлен'
}
if ($email) {
$SMTPClient = New-Object Net.Mail.SMTPClient($Server, $Port)
if (($Username) -and ($Password)) { $SMTPClient.Credentials = New-Object System.Net.NetworkCredential($Username, $Password) }
if ($SSL) { $SMTPClient.EnableSSL = $true }
$EmailMessage = New-Object System.Net.Mail.MailMessage
$EmailMessage.From = $From
$EmailMessage.To.Add( $To )
}
Switch ($ResultError) {
default {
write-host $Results
exit 0
}
1 {
write-host $Results
if ($email) { Send-EmailMessage }
exit 1
}
2 {
write-host $Results
if ($email) { Send-EmailMessage }
exit 2
}
}
$array = @()
$array2 = @()
$mailboxes = get-mailbox
$file = New-Item -itemtype file "C:\SCRIPTS\quotas.html" -Force
$mailalert=$false
Add-Content $file '<html><head>
<meta http-equiv="Content-Type" content="text/html;charset=windows-1251">
<title>System Status Report</title>
<style type="text/css">
<!--
BODY{background-color:#FFFFFF;}
TABLE{border-width: 1px;border-style: solid;border-color: black;}
TH{border-width: 1px;padding: 1px;border-style: solid;border-color: black;background-color:#1D92DC}
TD {border-width: 1px;padding: 2px;border-style: solid;border-color: black;background-color:#94BFE4}
TR {color:#000000;font-family:Tahoma;font-size:10pt;}
}
-->
</style>
<table>
<tr><th>mailbox: </th><th>state: </th></tr>
'
foreach ($line in $mailboxes) {
$user = $line.alias
$size2 = get-mailboxstatistics $user -erroraction silentlycontinue
if ($size2 -ne $null) {
$size = $size2.TotalItemSize.Value.ToMB()
}
$array += @(,($user,$size))
}
foreach ($line in $array) {
$user = $line[0]
$size = $line[1]
If ($user -notmatch 'DiscoverySearch') {
$quota2 = get-mailbox $user
$quotapsr = $quota2.ProhibitSendReceiveQuota
if ($quotapsr -ne "unlimited") {
$quotapsr = $quota2.ProhibitSendReceiveQuota.Value.ToMB()
if ($size -gt $quotapsr) {
$quotacheckpsr = "Over"
} else {
$quotacheckpsr = "Under"
}
} else {
$quotacheckpsr = "NoChecking"
}
$quotaiw = $quota2.IssueWarningQuota
if ($quotaiw -ne "unlimited") {
$quotaiw = $quota2.IssueWarningQuota.Value.ToMB()
if ($size -gt $quotaiw) {
$quotacheckiw = "Over"
} else {
$quotacheckiw = "Under"
}
} else {
$quotacheckiw = "NoChecking"
}
$quotaps = $quota2.ProhibitSendQuota
if ($quotaps -ne "unlimited") {
$quotaps = $quota2.ProhibitSendQuota.Value.ToMB()
if ($size -gt $quotaps) {
$quotacheckps = "Over"
} else {
$quotacheckps = "Under"
}
} else {
$quotacheckps = "NoChecking"
}
$array2 += @(,($user,$size,$quotacheckiw,$quotaiw,$quotacheckps,$quotaps,$quotacheckpsr,$quotapsr))
}
}
foreach ($line in $array2) {
if ($line[2] -eq "Over") {
$mbname=$line[0]
write-host "The mailbox for"$line[0]"is " -nonewline
write-host "OVER the Issue Warning Quota, " -ForegroundColor red -nonewline
Add-Content $file "<tr><td>$mbname</td><td style='background-color:red; color:Yellow;'><strong>OVER the Issue Warning Quota</strong></td></tr>"
$mailalert=$true
} else {
write-host "The mailbox for"$line[0]"is " -nonewline
write-host "UNDER the Issue Warning Quota, " -ForegroundColor green -nonewline
}
if ($line[4] -eq "Over") {
$mbname=$line[0]
write-host "OVER the Prohibit Send Quota," -ForegroundColor red -nonewline
Add-Content $file "<tr><td>$mbname</td><td style='background-color:red; color:Yellow;'><strong>OVER the Prohibit Send Quota</strong></td></tr>"
$mailalert=$true
} else {
write-host "UNDER the Prohibit Send Quota," -ForegroundColor green -nonewline
}
if ($line[6] -eq "Over") {
$mbname=$line[0]
write-host " and " -nonewline
write-host "OVER the Prohibit Send Receive Quota." -ForegroundColor red
Add-Content $file "<tr><td>$mbname</td><td style='background-color:red; color:Yellow;'><strong>OVER the Prohibit Send Receive Quota</strong></td></tr>"
$mailalert=$true
} else {
write-host " and " -nonewline
write-host "UNDER the Prohibit Send Receive Quota." -ForegroundColor green
}
}
if ($mailalert -eq $true) {
$html = Get-Content "C:\SCRIPTS\quotas.html" -raw
Send-MailMessage -smtpServer mail.domain.net -from 'alert@domain.net' -to 'admin@domain.net' -subject "Quotas" -body $html -Encoding UTF8 -BodyAsHTML
}[/noae][/noae]
$CurrentDate = get-date -format dd.MM.yyyy
$DC_Name = "NAME_"
$NPath = "\\storage\BACKUP\"
$Path_Net_Drive = $NPath + $DC_Name + $CurrentDate
$StoreBackup_Period = 5
$limit = (Get-Date).AddDays(-$StoreBackup_Period)
$from = "admin@domain.net"
$to = "admin@domain.net"
$smtp = "mail.domain.local"
$sub = "NAME LAST BACKUP RESULT"
Function CheckPath ($Path) {
$Path_Exists = Test-Path -Path $Path
If ($Path_Exists -eq $False) {New-Item $Path -type directory}
}
Add-PSSnapin Windows.Serverbackup -ErrorAction SilentlyContinue
$policy = New-WBPolicy
$target = New-WBBackupTarget -NetworkPath $Path_Net_Drive
Add-WBBareMetalRecovery -Policy $policy
Add-WBSystemState -policy $policy
Add-WBVolume -Policy $policy -Volume (Get-WBVolume -CriticalVolumes)
Set-WBVssBackupOptions -policy $policy -VssFullBackup
Add-WBBackupTarget -Policy $policy -Target $target
CheckPath $Path_Net_Drive | Out-Null
Start-WBBackup -Policy $policy
if ((Get-WBSummary).LastBackupResultHR -eq 0) {
Get-ChildItem -Path $NPath -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
Get-ChildItem -Path $NPath -Recurse -Force | Where-Object { $_.PSIsContainer -and (Get-ChildItem -Path $_.FullName -Recurse -Force | Where-Object { !$_.PSIsContainer }) -eq $null } | Remove-Item -Force -Recurse
}
else {
Get-WBSummary > C:\SCRIPTS\summary.txt
Send-MailMessage -To $to -From $from -Subject $sub -Attachments C:\SCRIPTS\summary.txt -SmtpServer $smtp -DeliveryNotificationOption Never
}
Страница создана за 0.040 сек. Запросов: 15.