How to Create a Class

The following VBScript code sample can be used 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: Creating a new Class object.

'   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

For more examples see How to Create a Property and How to Add Properties to a Class.