"Test-SqlAvailabilityGroup" takes too much time
I guess if you only want to see if the Availability group exists, you could query the DMV:
select name from sys.availability_groups

That will return all the name of the AG(s) on that specific instance.
It could be done from PowerShell too with a &quot;invoke-sqlcmd&quot; pretty easilly.