iispowershellremote-control

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


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


Solution

  • 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.