Saturday, February 6, 2016

Get websites and virtual subdirectory websites in IIS 6, 7, 8 - C#

This method will get basic site information from IIS for primary sites and virtual directory sites one level under the primary sites.This was inspired by other blog posts and code snippets but none of them took the additional step of getting the information about virtual sub directories, which can also be websites in an of themselves. (e.x. domain.com/subdomain)
Usage: GetSites("IIS://yourwebserver-name/W3SVC");