Iis – How to reference a site by ID using IIS7 APPCMD

configurationiisiis-7windows-server-2008

I know how to reference a site by name to stop and start it? For example:

appcmd stop site /site.name:"Microsoft SharePoint Administration"

How do I reference a site using its IIS ID? I tried these variations:

appcmd start stop /site.id:2
appcmd start stop /site.id:"2"
appcmd start stop /site.id:2
appcmd start site /section:sites /[id='2']

However they all return the following error:

ERROR ( message:Must specify the SITE object with identifier. )

Best Answer

Hmm - this works:

appcmd.exe list site -id:2

This doesn't:

appcmd.exe stop site -id:2