Share via


ManagementUnit.ServerManager Property

Definition

Gets the server manager for the management unit.

public:
 property Microsoft::Web::Administration::ServerManager ^ ServerManager { Microsoft::Web::Administration::ServerManager ^ get(); };
public Microsoft.Web.Administration.ServerManager ServerManager { get; }
member this.ServerManager : Microsoft.Web.Administration.ServerManager
Public ReadOnly Property ServerManager As ServerManager

Property Value

A ServerManager object that contains information about the server.

Examples

The following example uses the ServerManager property to get information about the sites on the server. The example writes the site names and states to trace output and stops any site that has been started.

public void TraceSM() {

    ManagementUnit mu = this.ManagementUnit;
    ServerManager sm = mu.ServerManager;
    Trace.WriteLine("Listing sites");
    Trace.Indent();
    foreach (Site x in sm.Sites) {
        Trace.WriteLine(x.Name + " state : " + x.State.ToString());
        if (x.Name == SH.SiteName &&
            x.State.ToString().ToLower().Contains("started")
            )
            x.Stop();
    }
    Trace.Unindent();
} 

Applies to