24

I've got an ASP.Net application which manages the IIS server as follows:

Successfully using Microsoft.Web.Administration.ServerManager to manage the local IIS 7 server no problem (I'm creating new sites, virtual folders etc on the fly).

What I really need to do is manage a remote server to do the same.

e.g. Web Application lives on IIS01, user clicks on "Create Virtual Folder" button, and this then connects to IIS02 to create the required folder.

I'm assuming that Microsoft.Web.Administration.ServerManager is NOT the correct way to go forward as this appears to manage the local instance only, so what is- if it's possible?

BIDeveloper
  • 2,628
  • 4
  • 36
  • 51
  • You might get better answers to your question on ServerFault.com. We're more about programming questions here. – DOK Jul 30 '10 at 15:21
  • 3
    This isn't a ServerFault question, **it's a programming question** about the [`Microsoft.Web.Administration.ServerManager`](http://msdn.microsoft.com/en-us/library/microsoft.web.administration.servermanager.aspx?ppud=4) class. This question should *not* be moved. – Nick Craver Jul 30 '10 at 15:23
  • 2
    It is a programming question.... check out (a) Microsoft.Web.Administration.ServerManager and (b) the c# asp.net tags – BIDeveloper Jul 30 '10 at 15:25

1 Answers1

30

You can use the static ServerManager.OpenRemote() method to get/mange a remote system:

var manager = ServerManager.OpenRemote("IIS02"); //Or, by IP "1.1.1.1"

This returns a ServerManager instance for that machine.

Nick Craver
  • 623,446
  • 136
  • 1,297
  • 1,155