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.

61 lines
1.9 KiB

  1. '***************************************************************************
  2. 'This script tests the manipulation of property values, in the case that the
  3. 'property is a not an array type
  4. '***************************************************************************
  5. Set Service = GetObject("winmgmts:root/default")
  6. On Error Resume Next
  7. Set aClass = Service.Get()
  8. aClass.Path_.Class = "SIMPLEPROPTEST00"
  9. Set Property = aClass.Properties_.Add ("p1", 3)
  10. Property.Value = 12567
  11. WScript.Echo "The initial value of p1 is [12567]:", aClass.Properties_("p1")
  12. '****************************************
  13. 'First pass of tests works on non-dot API
  14. '****************************************
  15. WScript.Echo ""
  16. WScript.Echo "PASS 1 - Use Non-Dot Notation"
  17. WScript.Echo ""
  18. 'Verify we can report the value of an element of the property value
  19. v = aClass.Properties_("p1")
  20. WScript.Echo "By indirection p1 has value [12567]:",v
  21. 'Verify we can report the value directly
  22. WScript.Echo "By direct access p1 has value [12567]:", aClass.Properties_("p1")
  23. 'Verify we can set the value of a single property value element
  24. aClass.Properties_("p1") = 234
  25. WScript.Echo "After direct assignment p1 has value [234]:", aClass.Properties_("p1")
  26. '****************************************
  27. 'Second pass of tests works on dot API
  28. '****************************************
  29. WScript.Echo ""
  30. WScript.Echo "PASS 2 - Use Dot Notation"
  31. WScript.Echo ""
  32. 'Verify we can report the value of a property using the "dot" notation
  33. WScript.Echo "By direct access p1 has value [234]:", aClass.p1
  34. 'Verify we can report the value of a property using the "dot" notation
  35. v = aClass.p1
  36. WScript.Echo "By indirect access p1 has value [234]:", v
  37. 'Verify we can set the value using dot notation
  38. aClass.p1 = -1
  39. WScript.Echo "By direct access via the dot notation p1 has been set to [-1]:", aClass.p1
  40. aClass.Put_ ()
  41. if Err <> 0 Then
  42. WScript.Echo Err.Description
  43. Err.Clear
  44. End if