访问和使用IIS中Metabase Schema

本文介绍如何利用VBScript编程语言结合ADSI技术来确定IIS中特定属性的数据类型,并列举了所有可用的元数据库节点属性。通过示例代码展示了获取属性数据类型及枚举属性的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

These examples were taken from the %SystemDrive%\Inetpub\AdminScripts\AdsUtil.vbs tool. AdsUtil.vbs contains more functionality and extensive error checking code that was not included in these samples in order to emphasize their purpose.

The following example code shows you how to use the VBScript programming language to determine the data type of a property.

This example uses ADSI.

IIsSchemaPath = "IIS://localhost/Schema/WAMUserPass" 
Set IIsSchemaObject = GetObject(IIsSchemaPath) 

If (Err.Number <> 0) Then 
  WScript.Echo "Error Trying To GET the Schema of the property: " & IIsSchemaPath 
  WScript.Quit (Err.Number) 
End If 

ObjectDataType = UCase(IIsSchemaObject.Syntax) 
WScript.Echo("Data type of " & IIsSchemaPath & " is " & ObjectDataType)

The following example code shows you how to use the VBScript programming language to enumerate all available properties at a metabase node.

This example uses ADSI.

Dim PropertyListSet 
Dim ADSIPath 
ADSIPath = "IIS://localhost/w3svc" 
Set IIsObject = GetObject(ADSIPath) 

' Get the Schema of the object and enumerate through all of the properties 
IIsSchemaPath = IIsObject.Schema 
Set IIsSchemaObject = GetObject(IIsSchemaPath) 

If (Err.Number <> 0) Then 
  WScript.Echo 
  WScript.Echo "Error Trying To GET the Schema of the class: " & IIsSchemaPath 
  WScript.Quit (Err.Number) 
End If 

ReDim PropertyListSet(1) 
PropertyListSet(0) = IIsSchemaObject.MandatoryProperties 
PropertyListSet(1) = IIsSchemaObject.OptionalProperties 

If (Err.Number <> 0) Then 
WScript.Echo 
ReportError () 
WScript.Echo "Error trying to get the list of properties: " & IIsSchemaPath 
WScript.Quit (Err.Number) 
End If 

WScript.Echo 
WScript.Echo("Available properties at " & ADSIPath) 
WScript.Echo("-----------------------------------") 
For Each PropertyList In PropertyListSet 
  'WScript.Echo("In " & PropertyList) 
  For Each PropertyName In PropertyList 
    WScript.Echo(PropertyName) 
  Next 
Next



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值