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

Solution 1:

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

To list your sites out:

%windir%\system32\inetsrv\appcmd list site

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

appcmd start site /site.name:string

or

appcmd stop site /site.name:string

Solution 2:

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