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.

38 lines
1007 B

  1. on error resume next
  2. Set Service = GetObject("winmgmts:root/default")
  3. 'Create a simple embeddable object
  4. Set aClass = Service.Get
  5. aClass.Path_.Class = "INNEROBJ00"
  6. aClass.Properties_.Add "p", 19
  7. aClass.Put_
  8. Set aClass = Service.Get ("INNEROBJ00")
  9. Set Instance = aClass.SpawnInstance_
  10. Instance.p = 8778
  11. 'Create a class that uses that object
  12. Set Class2 = Service.Get
  13. Class2.Path_.Class = "EMBOBJTEST00"
  14. Class2.Properties_.Add ("p1", 13).Value = Instance
  15. Class2.Put_
  16. Set aClass = GetObject("winmgmts:root/default:EMBOBJTEST00")
  17. WScript.Echo "The current value of EMBOBJTEST00.p1.p is [8778]:", aClass.p1.p
  18. set prop = aClass.p1
  19. prop.Properties_("p") = 23
  20. WScript.Echo "The new value of EMBOBJTEST00.p1.p is [23]:", aClass.p1.p
  21. prop.p = 45
  22. WScript.Echo "The new value of EMBOBJTEST00.p1.p is [45]:", aClass.p1.p
  23. aClass.p1.p=82
  24. WScript.Echo "The new value of EMBOBJTEST00.p1.p is [82]:", aClass.p1.p
  25. if Err <> 0 Then
  26. WScript.Echo Err.Description
  27. Err.Clear
  28. End if