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.

32 lines
943 B

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