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.

33 lines
1.0 KiB

  1. '***************************************************************************
  2. 'This script tests references methods on ISWbemServices and ISWbemObject
  3. '***************************************************************************
  4. On Error Resume Next
  5. while true
  6. 'Do it via a SWbemServices
  7. WScript.Echo
  8. WScript.Echo "Services-based call for all classes associated by instance"
  9. WScript.Echo
  10. Set Service = GetObject("winmgmts:{impersonationLevel=impersonate}")
  11. Set Enumerator = Service.ReferencesTo _
  12. ("Win32_DiskPartition.DeviceID=""Disk #0, Partition #1""", "Win32_SystemPartitions",,true)
  13. for each Thingy in Enumerator
  14. WScript.Echo Thingy.Path_.Relpath
  15. next
  16. 'Do it via a ISWbemObject
  17. WScript.Echo
  18. WScript.Echo "Object-based call for all classes associated in schema"
  19. WScript.Echo
  20. Set Object = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_DiskPartition")
  21. for each Thingy in Object.References_ (,,,true)
  22. WScript.Echo Thingy.Path_.Relpath
  23. next
  24. if Err <> 0 Then
  25. WScript.Echo Err.Description
  26. Err.Clear
  27. End if
  28. wend