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.

36 lines
987 B

  1. '***************************************************************************
  2. 'This script tests associators methods on ISWbemServices and ISWbemObject
  3. '***************************************************************************
  4. On Error Resume Next
  5. while true
  6. 'Do it via a ISWbemServices
  7. Set Service = GetObject("winmgmts:{impersonationLevel=impersonate}!root\cimv2")
  8. Service.Security_.ImpersonationLevel = 3
  9. if Err <> 0 Then
  10. WScript.Echo Err.Description
  11. Err.Clear
  12. End if
  13. Set Enumerator = Service.AssociatorsOf _
  14. ("\\ALANBOS3\Root\CimV2:Win32_DiskPartition.DeviceID=""Disk #0, Partition #1""", , "Win32_ComputerSystem",,,true)
  15. for each Thingy in Enumerator
  16. WScript.Echo Thingy.Path_.Relpath
  17. next
  18. 'Do it via a ISWbemObject
  19. Set Object = GetObject("winmgmts:Win32_DiskPartition")
  20. for each Thingy in Object.Associators_ (,,,,,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
  27. wend