Search Center | List of site and site collections | SharePoint 2010
I found an easy way to get the list of Sites and site collections just by using search. (No Code or customization required.) Thanks Corey Roth's article - https://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/01/13/how-to-query-site-and-site-collections-using-sharepoint-search.aspx?utm\_source=feedburner\&utm\_medium=feed\&utm\_campaign=Feed%3A+CoreysDotNetTipOfTheDay+%28Corey+Roth+-+DotNetMafia.com%29
To achieve this we make use of the managed property : ContentClass.
Simply put the text - contentclass:"STS_Web" in the search box and hit enter. You will get the list of all the sites in your farm (Or web applications serviced by that search service application) But this doesnt return any root sites.
To get even root sites, just change the text to contentclass:"STS_Site" contentclass:"STS_Web"
In my case, I’ll restrict the URL to web application.
contentclass:"STS_Site" contentclass:"STS_Web" site:<Url of web application>