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.

39 lines
1.1 KiB

  1. '***************************************************************************
  2. 'This script tests the setting of null property values and passing of
  3. 'null values to methods
  4. '***************************************************************************
  5. On Error Resume Next
  6. Set Locator = CreateObject("WbemScripting.SWbemLocator")
  7. 'Note next call uses "null" for first argument
  8. Set Service = Locator.ConnectServer (vbNullString, "root/default", null, null, null, , ,null)
  9. Set aClass = Service.Get
  10. 'Set up a new class with an initialized property value
  11. aClass.Path_.Class = "NULLPROPVALUETEST00"
  12. aClass.Properties_.Add ("P", 3).Value = 25
  13. aClass.Put_
  14. if Err <> 0 Then
  15. WScript.Echo Err.Description
  16. Err.Clear
  17. End if
  18. 'Now null the property value using non-dot access
  19. Set aClass = Service.Get ("NULLPROPVALUETEST00")
  20. Set Property = aClass.Properties_("P")
  21. Property.Value = null
  22. aClass.Put_
  23. 'Un-null
  24. Set aClass = Service.Get ("NULLPROPVALUETEST00")
  25. Set Property = aClass.Properties_("P")
  26. Property.Value = 56
  27. aClass.Put_
  28. 'Now null it using dot access
  29. Set aClass = Service.Get("NULLPROPVALUETEST00")
  30. aClass.P = null
  31. aClass.Put_