All scripts
Microsoft 365 484

Get-MailboxAutoReplyStatus

Lists every mailbox currently running an automatic reply, with the configured message and end date if one is set. Useful for spotting stale out-of-office replies nobody turned off.

Get-MailboxAutoReplyStatus.ps1
<#
.SYNOPSIS
    Lists mailboxes with an active automatic reply configured.

.DESCRIPTION
    Checks every user mailbox for an enabled or scheduled automatic reply,
    reports the internal message and any configured end date, so stale
    out-of-office replies get noticed instead of running forever.

.EXAMPLE
    .\Get-MailboxAutoReplyStatus.ps1

.NOTES
    Requires ExchangeOnlineManagement and an active Connect-ExchangeOnline session.

.AUTHOR
    Shehryar Hassan
#>

$mailboxes = Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox
$results = foreach ($mbx in $mailboxes) {
    $config = Get-MailboxAutoReplyConfiguration -Identity $mbx.Identity
    if ($config.AutoReplyState -ne "Disabled") {
        [pscustomobject]@{
            DisplayName = $mbx.DisplayName
            State       = $config.AutoReplyState
            EndTime     = $config.EndTime
            Message     = ($config.InternalMessage -replace '<[^>]+>', '').Trim()
        }
    }
}

if ($results) {
    $results | Sort-Object EndTime | Format-Table -AutoSize
} else {
    Write-Host "No mailboxes currently have an automatic reply configured." -ForegroundColor Green
}

Read it before you run it, and test in a safe tenant first.