Exchange daily check

Austin Sundar 436 Reputation points
2021-01-15T05:59:17.143+00:00

I am using this script for a daily check in the exchange environment. I am doing this manually and it takes 30-40 min to complete all the check.
Can anyone help me how to send this result directly to my mailbox? So I can schedule the script.

Get-MailboxDatabase | Get-MailboxDatabaseCopyStatus | ?{$.ContentIndexState -ne "Healthy"}
Get-MailboxDatabase -Status | ft name,lastfullbackup,*inprogress* -a -wr
Get-TransportServer | Get-Queue | ?{$
.MessageCount -gt 100}
Get-MailboxServer | Get-MailboxDatabaseCopyStatus | ?{$.copyqueuelength -gt 100}
Get-MailboxServer | Get-MailboxDatabaseCopyStatus | ?{$
.replayqueuelength -gt 100}
Get-DatabaseAvailabilityGroup * -Status | fl name,PrimaryActiveManager

Get-MailboxDatabase | Sort Name | ForEach {$db=$.Name;$xNow=$.Server.Name ;$dbown=$.ActivationPreference| Where {$.Value -eq 1}; Write-Host $db “on” $xNow “Should be on” $dbOwn.Key -NoNewLine; If ( $xNow -ne $dbOwn.Key){Write-host ” WRONG” -ForegroundColor Red; } Else {Write-Host ” OK” -ForegroundColor Green}}

Exchange Exchange Server Management
{count} votes

1 answer

Sort by: Most helpful
  1. KyleXu-MSFT 26,396 Reputation points
    2021-01-18T03:01:23.42+00:00

    @Austin Sundar

    Here are some suggestions which may be useful to you accomplish this goal:
    Create two Schedule Tasks:

    • Task one: Save this report to a CSV file.
    • Task two: Use Schedule Task to send this csv file as an attachment to the mailbox that you want.

    Before using Schedule Task to send email, you need to configure anonymous relay on your Exchange server first. For more detailed information, you can have a look about those two articles:
    Allow anonymous relay on Exchange servers
    PowerShell: Automate and schedule Task Scheduler sending email and attachment


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.