ScriptHalted when performing dm_hadr_database_replica_states
Closed this issue · 2 comments
DiHo78 commented
The script stops with error message
ScriptHalted
In C:\Vault\PShell\SQL-Server\MorningHealthCheck\Invoke-MorningHealthChecks.ps1:132 Zeichen:5
when running against older SQL instances (e.g. SQL 2008 R2) which do not support DMV dm_hadr_database_replica_states.
Quick workaround for me: putting the Availabilty group status test at the end of the script.
Long term fix: implementing a version check to skip the HADR check for older installations (or upgrade as soon as possible ;-) )
PatrickKeisler commented
That was by design; however, I should have noted within the script that it was designed for SQL Server 2012 and higher.
DiHo78 commented
Hi Patrick,
thx for mentioning.
I'm fine with that. Last SQL server 2008 is gone ;-)