ManagementUnit.ServerManager Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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();
}