I have a server that has hosted many sites over the years... as many as a hundred. I've got a lot of cruft in \inetpub\wwwroot that has not been well managed. Say I have a directory called "SomeDirectory". Is there any easy way to tell if any site in IIS 7.5 is bound to this physical location without going through them one by one?
1 Answer
To just see if a site uses the virtual Directory "SomeDirectory" you would use
appcmd list vdir /app.name: SITENAME / SomeDirectory
(exchanging SITENAME with the name of your site).
However if you want to give a physical directory and get all sites using it you need a more complicated command, piping the output from list vdir to list app to list site:
appcmd list vdir /physicalPath:C:\inetput\wwwroot\SomeDir /xml | appcmd list app /xml /in | appcmd list site /in
(exchange the physical path according to your needs).
-
Great, thanks Broco. I simplified it a great deal by just doing "appcmd list vdir | findstr MyDirectoryName" Aug 14, 2014 at 22:43
-