Skip to content

Instantly share code, notes, and snippets.

@SweetAsNZ
Created January 29, 2026 02:00
Show Gist options
  • Select an option

  • Save SweetAsNZ/5705e4774a85c5fc3ddcf56c5ec8c848 to your computer and use it in GitHub Desktop.

Select an option

Save SweetAsNZ/5705e4774a85c5fc3ddcf56c5ec8c848 to your computer and use it in GitHub Desktop.
Checks if log files are required for database recovery/backups for a specified Exchange mailbox database.
function Get-ExchangeLogFileRequired {
<#
.SYNOPSIS
Checks if log files are required for database recovery/backups for a specified Exchange mailbox database.
.DESCRIPTION
This function uses the eseutil command to check the header of the specified Exchange mailbox database file
to determine if any log files are required for database recovery or backups.
.PARAMETER DBName
The name of the Exchange mailbox database to check.
.EXAMPLE
Get-ExchangeLogFileRequired -DBName "DB1"
.NOTES
Author: Tim West
Created: 29/01/2026
Updated: 29/01/2026
Status: Production
Version: 1.0.0
.CHANGELOG
29/01/2026 - Initial creation of the function.
.TODO
- None
#>
[CmdletBinding()]
param(
[Parameter(Mandatory)][ValidateNotNullOrEmpty()]
[string]$DBName
)
$LogRequired = cmd /c eseutil /mh (Get-MailboxDatabase $DBName).EDBFilepath.PathName
if($LogRequired -match "Log Required: 0-0 \(0x0-0x0\)"){
Write-Host -f Green "No log files are required for database recovery/backups."
}
else{
Write-Warning "Log files are required for database recovery/backups."
Write-Output $LogRequired | Select-String "Log Required"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment