IIS - How to determine site Id

You can use appcmd list sites to get a list of sites and identifiers.

Open a command prompt using Run as Administrator.

C:\WINDOWS\system32\inetsrv>appcmd list sites
 
SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)
SITE "Site1" (id:2,bindings:http/*:80:site1.com,state:Started)
SITE "Site2" (id:3,bindings:http/*:80:site2.com,state:Started)

To find a site by name, use appcmd list site "SiteName":

C:\WINDOWS\system32\inetsrv>appcmd list site "Default Web Site"
 
SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)

To find a site by id, use appcmd list site -id:N:

C:\WINDOWS\system32\inetsrv>appcmd list site -id:1
 
SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)

Note: appcmd will still work as a non-admin, but will display "state:Unknown".


Ads by Google


Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath