How can restart IIS on a remote machine?
I know the IP address and administrator user's user name and password information.
I am using C# and ASP .NET 2.0.
How can restart IIS on a remote machine?
I know the IP address and administrator user's user name and password information.
I am using C# and ASP .NET 2.0.
You could use sc, as Thomas Franke suggested:
sc \\RemoteServer stop iisadmin
sc \\RemoteServer start w3svc
or SysInternals' psexec. The PsTools suite is useful for these scenarios.
psexec \\RemoteServer iisreset
You could use the "sc" command in order to control the iis-service on the remote machine.
sc \\RemoteServer stop [iis-service-name]
Use
sc help
in order to get a list of possible arguments.
Also take a look at a microsoft kb-article on your subject.
How remote is remote? You could just execute Shutdown.exe from your c# code? If that's not possible (firewalls etc) then the next best would probably be putting a service on there that you could call remotely (and securely!) that shuts the machine down.