Compartilhar via


Creating New Properties in the IIS ADSI Schema

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

To create a Property object, follow these steps:

  1. Bind to the Schema container.

  2. Create a new Property object.

  3. Set the syntax value of the object. The default syntax is String. See the table below for possible values.

  4. Write the new Class object to the metabase.

The following table lists the possible syntax values.

Syntax value

Description

Boolean

Boolean variable (TRUE or FALSE).

Integer

32-bit signed integer.

String

Null-terminated string.

ExpandSz

Double null-terminated list of strings.

List

Array of null-terminated strings.

IPSec

IPSecurity data type.

NTAcl

Windows access control list.

MimeMapList

Array of MimeMap objects.

Example Code

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

'   Get the parameters for the machine name. 
Dim MachineName 
Dim PropertyName 
Dim ArgObj 
Set ArgObj=WScript.Arguments 
MachineName = ArgObj.Item (0) 
PropertyName = ArgObj.Item (1) 

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

'   Create a new Property. 
Set NewPropertyObj = SchemaObj.Create ("Property", PropertyName) 

'   Set the syntax of the object. 
'   The default syntax is String. 
'   The syntax must be set before calling SetInfo. 
NewPropertyObj.Syntax = "string" 

'   Set the NewPropertyObject's attributes by inheritance. 
NewPropertyObj.Inherit = True 

'   Write NewPropertyObject to the metabase. 
NewPropertyObj.SetInfo