SMS脚本节选三:读取LAZY属性

This example shows how to retrieve lazy properties. The assigned schedule properties for advertisements are lazy. Therefore, when querying advertisements, each advertisement instance must be retrieved separately and the assigned schedule properties must be parsed separately.

For more information on lazy properties, see SMS Objects.

To read a lazy property

  1. Connect to an SMS Provider, and get the SWbemServices object.

  2. Get a collection of all advertisements:

    Set colAdvertisements = objSWbemServices.ExecQuery("Select * From SMS_Advertisement")
  3. Iterate through the advertisement collection and display the lazy properties:

    For Each objAdvert In colAdvertisements       WScript.Echo "ActionInProgress = " & objAdvert.ActionInProgress       WScript.Echo "AdvertFlags = " & objAdvert.AdvertFlags       WScript.Echo "AdvertisementID = " & objAdvert.AdvertisementID       WScript.Echo "AdvertisementName = " & objAdvert.AdvertisementName       'For the lazy properties, get the advertisements individually.       Set lazyproperties = objSWbemServices.Get("SMS_Advertisement.AdvertisementID='" & ObjAdvert.advertisementid & "'")       WScript.Echo "Assigned Schedule = {"              for i=0 to ubound(lazyproperties.assignedschedule,1)              WScript.Echo " instance of " & lazyproperties.Properties_("AssignedSchedule").Value(0).Path_.Class      WScript.Echo lazyproperties.Properties_("AssignedSchedule").Qualifiers_("CIMType")              WScript.Echo "   DayDuration: " & lazyproperties.AssignedSchedule(i).DayDuration              WScript.Echo "   Hourspan: " & lazyproperties.AssignedSchedule(i).HourSpan              WScript.Echo "   IsGMT: " & lazyproperties.AssignedSchedule(i).IsGMT              WScript.Echo "   StartTime: " & lazyproperties.AssignedSchedule(i).StartTime              WScript.Echo "AssignedScheduleEnabled = " & lazyproperties.AssignedScheduleEnabled          WScript.Echo "AssignedScheduleIsGMT = " & lazyproperties.AssignedScheduleIsGMT   next       WScript.Echo "}"              WScript.Echo "CollectionID = " & objAdvert.CollectionID       WScript.Echo "Comment = " & objAdvert.CommentNext



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值