Share via


Windows ADSI Reference

The IIS ADSI Provider Reference section describes the objects, methods, and properties that are exposed by the IIS ADSI Provider only. Any script or code that uses Actve Directory Services Interfaces (ADSI) needs to use some basic Windows ADSI interfaces. The Windows ADSI interfaces include methods and properties which are frequently used. For example, the ADSI object Get and Set methods allow you to change properties in a data store such as the IIS metabase, and the ADSI object SetInfo saves the changes. When writing scripts and code that use ADSI, it saves time to keep open a reference to the Windows ADSI interfaces.

The objects, properties, and methods of the Windows ADSI interfaces are already documented in the Windows Platform SDK under Directory Services, Active Directory Services Interfaces (ADSI), ADSI Reference. You can also view it on MSDN online at ADSI Reference.

Example

The following sample VBScript code shows how you can use the ADSI methods of the IIS ADSI Objects to change values in the metabase, and illustrates the use of metabase property inheritance for efficiency. MyComputer is a placeholder for the name of the computer on which IIS is running.

   Dim WebServerObj 
  Dim VDirObj 


  '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)
  'by 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 
  'by using the dot method equivalent to Put. 
  VDirObj.AccessWrite = True 
 
  'Save the changed value to the metabase. 
  VDirObj.SetInfo

Related Topics