You can use the IIS Admin Objects to configure your IIS installation, creating new FTP and Web servers, virtual directories, and other IIS elements, and also changing settings that affect IIS operation. Your IIS configuration information is stored as values in the metabase, called metabase properties, and you use the IIS Admin Objects to change these configuration values. Individual IIS Admin Objects correspond to specific types of keys in the metabase. With simple ASP scripts, you can use the IIS Admin Objects to create powerful and flexible custom administration applications for remote administration of your IIS installation. The remote Internet Service Manager (HTML) for IIS was developed using the IIS Admin Objects with VBScript and JScript™. The source code files for this program are located in \system32\inetsev\iisadmin in your system directory.
The IIS Admin Objects expose a hierarchical namespace of objects where each object has an ADsPath, similar to a Uniform Resource Locator (URL), that is prefixed with IIS:// followed by the name of the computer on which IIS is running, followed by the path of the object in the metabase. For example, IIS://MyComputer/W3SVC refers to the IIsWebService object for the machine named MyComputer. The object associated with the machine on which IIS is running is the IIsComputer object, and contains all of the other IIS Admin Objects directly or indirectly. To get a reference to a named object, you use the GetObject function in Visual Basic®, VBScript or other scripting languages. For example, you can retrieve the current value of MaxBandwidth for the computer named MyComputer
with the following VBScript in an .asp file. You can use LocalHost instead of MyComputer
to access the computer on which IIS is running.
<%
Dim ComputerObj
Dim MaxBW
Set ComputerObj = GetObject("IIS://MyComputer")
MaxBW = ComputerObj.Get("MaxBandwidth")
' You could also use MaxBW = ComputerObj.MaxBandwidth
%>
Note ASP scripts that access the metabase require administrator privileges on the machine on which IIS is running. When you execute these scripts from a remote machine, you must connect through a secure connection, such as the Windows NT Challenge/Response authentication method. It is suggested that you create a server or directory for your administrative .asp files and set the directory security authentication method to Windows NT Challenge/Response for the server or directory.
Note For security purposes, out-of-process applications cannot access the metabase. It is recommended that you retain this default behavior unless special circumstances require otherwise. There are two ways you can modify this behavior, but each introduces some security risk. One approach is to give the IWAM_machinename account access to the metabase, which will allow access to the metabase for all out-process-applications created with this default identity. Another approach is to change the identity of the specific out-of-process-package to some other account identity and give that account access to the metabase. This introduces some risk but less than that introduced by giving metabase access to the IWAM_machinename account.
The topics in this section explain how to use the ADSI methods for the IIS Admin Objects, and provide a sample program using these methods.