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.

43 lines
1.2 KiB

  1. '***************************************************************************
  2. 'This script tests the enumeration of subclasses
  3. '***************************************************************************
  4. On Error Resume Next
  5. Dim objLocator
  6. Set objLocator = CreateObject("WbemScripting.SWbemLocator")
  7. ' Replace the first argument to this function with the URL of your WMI XML/HTTP
  8. server
  9. ' For the local machine, use the URL as below
  10. Dim objService
  11. Set objService = objLocator.ConnectServer("[http://localhost/cimom]", "root\cimv2")
  12. if err <> 0 then
  13. WScript.Echo ErrNumber, Err.Source, Err.Description
  14. else
  15. WScript.Echo "ConnectServer Succeeded"
  16. end if
  17. Set parentClass = objService.Get("")
  18. if err <> 0 then
  19. WScript.Echo ErrNumber, Err.Source, Err.Description
  20. else
  21. WScript.Echo "Get Succeeded"
  22. end if
  23. Set DiskSubclass = parentClass.SpawnDerivedClass_()
  24. 'Set the name of the subclass
  25. DiskSubClass.Path_.Class = "NewClass4"
  26. 'Add a property to the subclass
  27. Set NewProperty = DiskSubClass.Properties_.Add ("MyNewProperty", 19)
  28. NewProperty.Value = 12
  29. 'Persist the subclass in CIMOM
  30. DiskSubclass.Put_ ()
  31. if Err <> 0 Then
  32. WScript.Echo Err.Description
  33. Err.Clear
  34. End if