次の方法で共有


Enumerating Properties Using ADSI

You can use ADSI to enumerate IIS metabase properties when you want to display configuration data that is stored at a specific metabase node.

Using ADSI

The following example shows you how to use the JScript programming language to search for a specific Web site (the default Web site) on an IIS server.

This example uses ADSI. For an example that uses System.DirectoryServices, see Enumerating Properties Using System.DirectoryServices.

var siteToSearchFor = "Default Web Site"; 

var w3svc = GetObject( "IIS://localhost/w3svc" ); 
var e = new Enumerator( w3svc ); 
for(; ! e.atEnd(); e.moveNext() ) 
{ 
var site = e.item(); 
if ( site.ServerComment == siteToSearchFor ) 
{ 
WScript.Echo( "Site ID: " + site.Name ); 
WScript.Quit( 0 ); 
} 
} 

WScript.Echo( "Site not found" );