Kev
Kev

Reputation: 119816

How do I reference a site by ID using IIS7 APPCMD?

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. )

Upvotes: 3

Views: 4150

Answers (2)

JulissaX
JulissaX

Reputation: 21

Work for me, but it isn't perfect:

Id website = 169

%systemroot%\system32\inetsrv\APPCMD list sites /xml | find "169"

Upvotes: 2

DmitryK
DmitryK

Reputation: 5582

Doesn't look like it is supported. You can supply site name or URL but not site ID.

C:\Windows\System32\inetsrv>appcmd stop site /? Stop virtual site

APPCMD stop SITE <-parameter1:value1 ...>

Stops the specified virtual site, and prevents new requests from being received on its binding endpoints. The exact site identifier must be provided and must resolve to an existing site.

Supported parameters:

identifier (required)

Site name or url of the site to stop

/site.name

Site name or url of the site to stop (same as identifier)

Upvotes: 3

Related Questions