Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop/start IIS 7 application through command line?

I would like to create a batch file to start one IIS application, and stop another one.

How it can be done using command line?

How to combined it in batch file?

like image 676
Eugene Avatar asked Jan 05 '12 14:01

Eugene


People also ask

How stop IIS from command line?

Open an elevated command-line window. At the command prompt, type net stop WAS and press ENTER; type Y and then press ENTER to stop W3SVC as well.

How do I stop IIS from PowerShell?

To stop a website that runs on IIS Server, Open a PowerShell console and run the following cmdlet to list all sites that are running or stopped on the server. Note the name of the site you would like to stop. Using the site name, run this command to stop the website without a confirmation prompt.


1 Answers

http://www.windowsnetworking.com/articles_tutorials/Configuring-IIS-7-command-line-Appcmdexe-Part1.html

Put this into a file with .bat extension.

@echo off  appcmd start sites "site1" appcmd stop sites "site2" 

Update

Just ensure that appcmd is available anywhere by adding %windir%\system32\inetsrv\ to the PATH environment variable of your system. Alternatively, you can use the full path to appcmd.exe in the batch file.

like image 168
adarshr Avatar answered Oct 09 '22 03:10

adarshr