Add-PSSnapin microsoft.exchange* Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 $servers="mailbox1","mailbox2" $i_Object = New-Object PSObject foreach ($server in $servers) { $status=Get-MailboxDatabaseCopyStatus -Server $server | % {$_.status} if ($status | ? {$_ -notmatch "Healthy|Mounted" -and $_ -ne""} ) {$status = "1"} #1表示OK else {$status = "0"} #0表示bad $i_object | Add-Member -MemberType NoteProperty -name $server -value $status } $i_object |fl