How to Create a Property

The following VBScript code sample can be used 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. The following table lists the possible syntax values.
Syntax value Description
Boolean Boolean variable (should be 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.

  1. Write the new Class object to the metabase.
Example: Creating a new Property object.
''''''''''''''''''''''''''''
'   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"

'   Write NewPropertyObject to the metabase.
NewPropertyObj.SetInfo

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

'   Write NewPropertyObject to the metabase.
NewPropertyObj.SetInfo
 

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