ADSI Object Methods

You use the ADSI methods of the IIS Admin Objects to change metabase property values that control your IIS configuration. To configure a specific element of IIS, you open the IIS Admin Object that corresponds to the metabase key associated with that element, modify the property values cached in the object, and direct the object to store the modified values into the metabase.

These ADSI methods of the IIS Admin Objects manipulate metabase properties.

Method Description
Get Retrieves value for a named property from the object.
GetEx Retrieves value(s) for a named single- or multi-valued property of the object.
GetInfo Reloads the object with property values that exist in the metabase.
GetInfoEx Reloads the object with property values from the metabase.
Put Sets the value for a named property of an object.
PutEx Sets value(s) for a named single- or multi-valued property of the object.
SetInfo Writes object property values to the metabase.

The GetInfo method reloads the property values from the metabase into the object. When one of the IIS Admin Objects is created or opened with the GetObject function, its properties are initialized from the metabase. You can refresh these values from the metabase using the GetInfo or GetInfoEx methods, overwriting any changes you have made to the property values cached in the object. You then use the Get or GetEx methods to retrieve the object properties into variables, and the Put and PutEx methods to modify property values in the object. The IIS Admin Objects also support the object.property syntax when used with languages such as VBScript or JScript. You use the SetInfo method to write property values from the object to the metabase. When you call SetInfo, only the properties that you changed in the object are written back to the metabase. If you do not call SetInfo, your changes will not be written to the metabase.

Note  When you retrieve metabase properties into one of the IIS Admin Objects, the metabase is not locked while you are changing property values in the object. Other programs may make changes to values in the metabase after you have retrieved values and before you save them back into the metabase. The final values in the metabase will reflect the last change written. Your program should minimize the time between retrieving and saving values.

ADSI properties apply only to the object, and non-ADSI properties apply to the metabase. You must use the object.property syntax when retrieving ADSI properties, whereas you may use either the object.property syntax or the ADSI methods such as Get and Put when manipulating metabase properties.

Example

This sample VBScript code shows how you use the ADSI methods of the IIS Admin Objects to change values in the metabase, and illustrates the use of metabase property inheritance for efficiency. You can use LocalHost instead of MyComputer to access the computer on which IIS is running.

<% 
Dim WebServerObj 
Dim VDirObj 
Dim WritePerm 
 
' Open the object for the first virtual Web server root 
Set WebServerObj = GetObject("IIS://MyComputer/W3SVC/1/Root") 
 
' Deny write access for all directories and files 
' for the server (except those already specifically set) 
' Using the Put method 
WebServerObj.Put "AccessWrite", False 
 
' Save the changed value to the metabase 
WebServerObj.SetInfo 
 
' Get a directory subordinate to the Web server root 
Set VDirObj = GetObject("IIS://MyComputer/W3SVC/1/Root/Vdir1/Dir1a") 
 
' Overwrite the inherited value for write access 
' Using the dot method equivalent to Put 
VDirObj.AccessWrite = True 
 
' Save the changed value to the metabase 
VDirObj.SetInfo 
%>