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.

writerrajiv
  • 31
  • 1
  • 5

2 Answers2

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

  • 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 – writerrajiv May 05 '16 at 14:29
  • 2
    You can use iisreset with other machine too. Only use iisreset , change with another server. – Mattew Developer May 05 '16 at 14:33
  • I will implement this command on Jenkins and would keep you updated. – writerrajiv May 06 '16 at 05:46
  • 1
    IIS Reset is working that way, but it will be great, if I can only stop 1 site on other server. – writerrajiv May 06 '16 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. – Extreme Jun 01 '20 at 13:47
0

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

writerrajiv
  • 31
  • 1
  • 5