2

We are using Jenkins as our Continous Integration Server. One of our project requires restarting IIS website on other Server. We can use "cd %windir%\system32\inetsrv appcmd stop site /site.name:xyz" appcmd start site /site.name:xyz" to restart xyz site from the same server.

We are unable to CD to network path using CD. I tried with Powershell, and I can cd to network location. I have tried Stop-Site, which doesn't works. I want powershell script or batch file, which can help me to restart IIS website on other server.

Any help will be greatly appreciated.

2 Answers 2

0

You can restart it with iisreset. Just run command prompt like admin and run it:

iisreset

If you want know other on iisreset see here How to reset IIS with the IIS Reset command

5
  • 1
    I want to use iisreset on other machine. This can work only on same server. I want to use iisreset from server 1 to server 2 Commented May 5, 2016 at 14:29
  • 2
    You can use iisreset with other machine too. Only use iisreset <servername>, change <servername> with another server. Commented May 5, 2016 at 14:33
  • I will implement this command on Jenkins and would keep you updated. Commented May 6, 2016 at 5:46
  • 1
    IIS Reset is working that way, but it will be great, if I can only stop 1 site on other server. Commented May 6, 2016 at 14:22
  • does not this command require a username and password? invoke-command -computername $serverName {cd C:\Windows\System32\; ./cmd.exe /c "iisreset /noforce /RESTART" } I have this script and is working on same machine but on remote. Commented Jun 1, 2020 at 13:47
0

Finally, I did it with powershell coding and functions CI_IIS_Reset.exe STARTWEBSITE servername sitename username password

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.