Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.4 KiB

  1. '***************************************************************************
  2. 'This script tests the inspection of empty arrays on properties, qualifiers
  3. 'and value sets
  4. '***************************************************************************
  5. On Error Resume Next
  6. Set Service = GetObject("winmgmts:root/default")
  7. Set MyClass = Service.Get
  8. MyClass.Path_.Class = "EMPTYARRAYTEST00"
  9. '*************************
  10. 'CASE 1: Property values
  11. '*************************
  12. Set Property = MyClass.Properties_.Add ("p1", 2, true)
  13. Property.Value = Array
  14. value = MyClass.Properties_("p1").Value
  15. WScript.Echo "Array upper bound for property value is [-1]:", UBound(value)
  16. WScript.Echo "Base CIM property type is [2]", Property.CIMType
  17. WScript.Echo
  18. if Err <> 0 Then
  19. WScript.Echo Err.Number, Err.Description, Err.Source
  20. Err.Clear
  21. End if
  22. '*************************
  23. 'CASE 2: Qualifier values
  24. '*************************
  25. MyClass.Qualifiers_.Add "q1", Array
  26. value = MyClass.Qualifiers_("q1").Value
  27. WScript.Echo "Array upper bound for qualifier value is [-1]:", UBound(value)
  28. WScript.Echo
  29. MyClass.Put_
  30. 'Now read them back and assign "real values"
  31. Set MyClass = Service.Get("EMPTYARRAYTEST00")
  32. MyClass.Properties_("p1").Value = Array (12, 34, 56)
  33. value = MyClass.Properties_("p1").Value
  34. WScript.Echo "Array upper bound for property value is [2]:", UBound(value)
  35. WScript.Echo "Base CIM property type is [2]", Property.CIMType
  36. WScript.Echo
  37. MyClass.Properties_("p1").Value = Array
  38. value = MyClass.Properties_("p1").Value
  39. WScript.Echo "Array upper bound for property value is [-1]:", UBound(value)
  40. WScript.Echo "Base CIM property type is [2]", Property.CIMType
  41. WScript.Echo
  42. MyClass.Qualifiers_("q1").Value = Array ("Hello", "World")
  43. value = MyClass.Qualifiers_("q1").Value
  44. WScript.Echo "Array upper bound for qualifier value is [1]:", UBound(value)
  45. MyClass.Qualifiers_("q1").Value = Array
  46. value = MyClass.Qualifiers_("q1").Value
  47. WScript.Echo "Array upper bound for qualifier value is [-1]:", UBound(value)
  48. WScript.Echo
  49. MyClass.Put_
  50. '*************************
  51. 'CASE 3:Named Values
  52. '*************************
  53. Set NValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")
  54. Set NValue = NValueSet.Add ("Foo", Array)
  55. value = NValueSet("Foo").Value
  56. WScript.Echo "Array upper bound for context value is [-1]:", UBound(value)
  57. if Err <> 0 Then
  58. WScript.Echo Err.Number, Err.Description, Err.Source
  59. Err.Clear
  60. End if