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.

31 lines
1.0 KiB

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