To retrieve a list of virtual roots and their indexed state, you need only execute a special query. The results are returned in the same manner as a standard query results page, and can be formatted using standard .htx templates. To retrieve the list of virtual roots, set the CiScope parameter in an .idq file to be the string: VIRTUAL_ROOTS. The .idq syntax requires CiRestriction be set to a non-null value, but a restriction such as #vpath * can be used to retrieve all roots.
The properties that can be retrieved from this query are all the standard file properties (path, virtual path, and so on) of the directory to which the virtual root maps: metavrootused. This Boolean value is set to TRUE if the root is indexed, FALSE if it is not.
You can determine the type of a virtual root while making the VIRTUAL_ROOTS query. Look at the value of the special property StorageType(DBTYPE_UI4) = b725f130-47ef-101a-a5f1-02608c9eebac 4. The value 0 identifies a Web root. The value 1 identifies a news root.