This T-SQL sample script quickly captures topology of an AlwaysOn configuration in SQL Server.
Knowing a topology is a frequent ask in TechNet forums and in CSS for troubleshooting. IT professionals want to understand the topology so as to quickly understand help in troubleshooting. There are multiple dynamic views (DMVs) to get this data so getting this data manually is possible but can take longer. This script has been tested in SQL Server 2012.
This script queries Dynamic Management Views DMVs and draws out the AlwaysOn topology. It helps us understand the topology and displays various other details that we need to understand the issue and thus helps us to troubleshoot the issue faster.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery