exchange 2010 sp2 后续之日常维护脚本

一晃8个小时过去了,给客户写好报告,客户说我定期需要执行哪些脚本来检查,好吧再提供一些月度的小脚本给他们使用,其实也可以用在我们升级之前的检查工作:

1)前一篇中的DAG 检查状态:

(Get-DatabaseAvailabilityGroup -Identity (Get-MailboxServer -Identity $env:computername).DatabaseAvailabilityGroup).Servers | Test-MapiConnectivity | Sort Database | Format-Table -AutoSize
Get-MailboxDatabase | Sort Name | Get-MailboxDatabaseCopyStatus | Format-Table -AutoSize
function CopyCount
{
$DatabaseList = Get-MailboxDatabase | Sort Name
$DatabaseList | % {
$Results = $_ | Get-MailboxDatabaseCopyStatus
$Good = $Results | where { ($_.Status -eq "Mounted") -or ($_.Status -eq "Healthy") }
$_ | add-member NoteProperty "CopiesTotal" $Results.Count
$_ | add-member NoteProperty "CopiesFailed" ($Results.Count-$Good.Count)
}
$DatabaseList | sort copiesfailed -Descending | ft name,copiesTotal,copiesFailed -AutoSize
}
CopyCount
 

 

2)exchange 数据库健康检查:

Add-PSSnapin *0* -ErrorAction SilentlyContinue
$mailboxservers = get-mailboxserver | get-exchangeserver | ?{$_.IsE14OrLater -eq 'True'}
$A = (get-host).UI.RawUI
$A.WindowTitle = "Database Health Check"
$B = $A.windowsize
$B.width = 110
$B.height = 30
$A.WindowSize = $B
while ($true) {cls; foreach ($mailboxserver in $mailboxservers){Get-MailboxDatabaseCopyStatus -Server $mailboxserver.name | ft -AutoSize Name,*Status,ContentIndexState,CopyQueueLength,ReplayQueueLength} ;sleep 5}

3)查看队列状态:

Get-Message -servername\Unreachable | ft Identity, FromAddress, Status

4)数据库的相关信息:

Get-MailboxDatabase | Select-Object Name,Server,StorageGroup,
Mounted,*Quota* | Export-CSV  c:\mailboxdb.csv

 

5)数据库大小等信息:

Get-MailboxDatabase -Status | select-object Name,DatabaseSize

 

6)查看磁盘空间:

Get-WmiObject Win32_LogicalDisk -Filter "DriveType='3'" | select @{n="Drive";e={$_.DeviceId}},@{n="Size";e={[math]::Round($_.Size/1gb,2)}},@{n="FreeSpace";e={[math]::Round($_.FreeSpace/1gb,2)}}

 

希望对大家升级有帮助:)

 

 

你可能感兴趣的:(职场,Exchange,休闲,2010)