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
1.1 KiB

  1. //***************************************************************************
  2. //This script tests references methods on ISWbemServices and ISWbemObject
  3. //***************************************************************************
  4. //Do it via a SWbemServices
  5. WScript.Echo ();
  6. WScript.Echo ("Services-based call for all classes associated by instance");
  7. WScript.Echo ();
  8. var Service = GetObject("winmgmts:{impersonationLevel=impersonate}");
  9. var Enum = Service.ReferencesTo
  10. ('Win32_DiskPartition.DeviceID="Disk #0, Partition #1"', "Win32_SystemPartitions", null, true);
  11. for (var e = new Enumerator (Enum); !e.atEnd(); e.moveNext ())
  12. {
  13. var Thingy = e.item();
  14. WScript.Echo (Thingy.Path_.Relpath);
  15. }
  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. var Object = GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_DiskPartition");
  21. for (var e = new Enumerator (Object.References_ (null,null,null,true)); !e.atEnd(); e.moveNext ())
  22. {
  23. var Thingy = e.item();
  24. WScript.Echo (Thingy.Path_.Relpath);
  25. }