How To start/stop IIS 6.0/7.0 remotely using PowerShell Scripts?

Selwyn picture Selwyn · Aug 31, 2009 · Viewed 48.2k times · Source

I have two servers Server A and Server B. I want to stop server A from Server B remotely using Powershell script.

Answer

Chris Marisic picture Chris Marisic · Aug 31, 2009

One of the simplest ways to do this is really with just a command line execution using PsExec. And send over to the machines

IISReset /STOP or /START or /RESTART

So you'd do something like this

PsExec \\Server2 -u Administrator -p somePassword IISReset /STOP

Just be careful with password management if you go this route or any route that involves some type of admin level account impersonation so that no one can get a plain text copy of the admin password.