Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I restart a single website in IIS7+ using commandline only?

Same functionality as the circled menu item in the image - but from the commandline.

enter image description here

Iisreset does not have any options to deal with individual files, and I found some ancient references to Iisweb.vbs, which seems to be outdated.

share|improve this question
up vote 7 down vote accepted

What you are looking for is the appcmd command. Take a look at its TechNet manual.

To list your sites out:

appcmd list site

To restart your site, stop it and then start it:

appcmd start | stop site /site.name:string

share|improve this answer
    
Just a note - i was in the iisexpress directory (cd \Program Files\IIS Express) and was baffled as to where the start option had gone. Make sure you are actually using the correct web server i.e. C:\Windows\System32\inetsrv fo IIS. Just to avoid others making my mistake – Crab Bucket Sep 15 '15 at 10:03
    
Any thought why the above command would give me 'stop' is not recognized as an internal or external command, operable program or batch file.? I have verified that start and stop commands work individually, but not through piping. – dotNET Mar 1 at 14:30

I'd personally suggest not stopping and starting sites, but recycling the associated Application Pool.

This should be closer to imperceptible for end users, while a stop/start will probably produce 503s while the site's down.

APPCMD LIST WP

APPCMD RECYCLE WP

are the command-line versions of this...

share|improve this answer

List your existing web sites with:

C:\> iisweb.vbs /query

and you can then restart a specific website by executing:

C:\> iisweb.vbs /stop <website> && iisweb.vbs /start <website>
share|improve this answer
    
iisweb is no longer used in IIS 7 and beyond. – Wesley Oct 9 '11 at 0:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.