Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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" );