Partager via


Creating New Classes in the IIS ADSI Schema

You can use the following VBScript code sample to add a new Class object to the IIS ADSI Schema.

To create a Class object, follow these steps:

  1. Bind to the Schema container.

  2. Create a new Class object.

  3. Write the new Class object to the metabase.

Example Code

The following example shows you how to use the VBScript programming language to a new class object in the IIS ADSI schema.

'   Get the parameters for the machinename 
Dim ArgObj 
Set ArgObj=WScript.Arguments 

MachineName = ArgObj.Item (0) 
ClassName = ArgObj.Item (1) 

'   Bind to the Schema container object. 
Dim SchemaObj 
Dim NewClassObj 
Set SchemaObj = GetObject ("IIS://" & MachineName & "/Schema") 

'   Create a new Class object for ClassName. 
Set NewClassObj = SchemaObj.Create ("Class", ClassName) 

'   Write the new Class object to the metabase. 
NewClassObj.SetInfo