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

后端 未结 6 2666
一向
一向 2021-02-20 04:42

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

6条回答
  •  一向
    一向 (楼主)
    2021-02-20 05:04

    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.

提交回复
热议问题