I recently found myself in the situation of needing to know what Dynamics AX Application Object Servers (AOS) are online in an environment.  The situation was a bit simplified because all of the AOS were served by the same SQL Server.  So I set out to build a SQL script which would query all of the relevant AX databases, look at the online servers and clients then summarize what it found.  After some tinkering I was able to create the following result:

Here is the query should you want to use it!