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.

69 lines
2.1 KiB

  1. // Set the locale and check display name is OK
  2. WScript.Echo ("Pass 1 - Set locale in SWbemObjectPath");
  3. WScript.Echo ("======================================");
  4. WScript.Echo ("");
  5. var obj = new ActiveXObject ("WbemScripting.SWbemObjectPath");
  6. obj.Security_.impersonationLevel = 3;
  7. obj.Server = "myServer";
  8. obj.Namespace = "root\default";
  9. obj.Locale = "ms_0x409";
  10. WScript.Echo (obj.Locale);
  11. WScript.Echo (obj.DisplayName);
  12. WScript.Echo ("");
  13. WScript.Echo ("");
  14. // Now feed the display name the object
  15. WScript.Echo ("Pass 2 - Set locale in Display Name");
  16. WScript.Echo ("===================================");
  17. WScript.Echo ("");
  18. obj.DisplayName = "winmgmts:[locale=ms_0x409]!root\\splodge";
  19. WScript.Echo (obj.Locale);
  20. WScript.Echo (obj.DisplayName);
  21. WScript.Echo ("");
  22. WScript.Echo ("");
  23. // Now Set locale direct
  24. WScript.Echo ("Pass 3 - Set locale directly");
  25. WScript.Echo ("============================");
  26. WScript.Echo ("");
  27. obj.DisplayName = "winmgmts:root\\splodge";
  28. obj.Locale = "ms_0x408";
  29. WScript.Echo (obj.Locale);
  30. WScript.Echo (obj.DisplayName);
  31. obj.Locale = "";
  32. WScript.Echo (obj.Locale);
  33. WScript.Echo (obj.DisplayName);
  34. WScript.Echo ("");
  35. WScript.Echo ("");
  36. // Plug the locale into the moniker
  37. WScript.Echo ("Pass 4 - Set locale in moniker");
  38. WScript.Echo ("=============================");
  39. WScript.Echo ("");
  40. var Service = GetObject ("winmgmts:[locale=ms_0x409]!root\\default");
  41. var cim = Service.Get ("__cimomidentification=@");
  42. WScript.Echo (cim.Path_.Locale);
  43. WScript.Echo (cim.Path_.DisplayName);
  44. WScript.Echo ("");
  45. WScript.Echo ("");
  46. // Plug the locale into ConnectServer
  47. WScript.Echo ("Pass 5 - Set locale in ConnectServer");
  48. WScript.Echo ("====================================");
  49. WScript.Echo ("");
  50. var Locator = new ActiveXObject ("WbemScripting.SWbemLocator");
  51. var Service = Locator.ConnectServer (null,null,null,null,"ms_0x409");
  52. Service.Security_.impersonationLevel = 3;
  53. var disk = Service.Get ('Win32_LogicalDisk="C:"');
  54. WScript.Echo (disk.Path_.locale);
  55. WScript.Echo (disk.Path_.DisplayName);
  56. WScript.Echo ("");
  57. WScript.Echo ("");