Iis – Unable to restart IIS Website from Other Server

iisJenkins

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.

Best Answer

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