I have two servers Server A and Server B. I want to stop server A from Server B remotely using Powershell script.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With