param([Parameter(Mandatory = $true)][string]$ConfigPath) $ErrorActionPreference = 'Stop' . (Join-Path $PSScriptRoot 'mail-common.ps1') $context = Get-MailContext -ConfigPath $ConfigPath $db = Open-MailDatabase $context try { $command = $db.CreateCommand() $command.CommandText = 'SELECT COUNT(*) FROM [TemplateVersion]' if ([int]$command.ExecuteScalar() -ne 1) { throw 'Expected exactly one validated template' } Write-Output 'Invalid imports left template count unchanged' } finally { $db.Dispose() }