Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 480
Selwyn Avatar asked Aug 31 '09 10:08

Selwyn


1 Answers

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.

like image 123
Chris Marisic Avatar answered Oct 02 '22 14:10

Chris Marisic