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.

46 lines
930 B

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Sample page showing the use of the WMIObjectBroker</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <br>
  7. Click <SPAN id=ShowProcesses><b>HERE</b></SPAN> to use WMI to show a list of processes<br>
  8. <SCRIPT LANGUAGE="JSCRIPT">
  9. function UseLocator(locator)
  10. {
  11. // This function is passed a locator and displayes a message
  12. // box that lists all running services.
  13. var service = locator.ConnectServer();
  14. var procs = service.InstancesOf("Win32_Process");
  15. var f = new Enumerator(procs);
  16. sz = "";
  17. for (;!f.atEnd();f.moveNext())
  18. {
  19. var proc = f.item();
  20. sz += proc["Name"] + "\r\n";
  21. }
  22. alert(sz);
  23. }
  24. function ShowProcesses.onclick()
  25. {
  26. var locator;
  27. try
  28. {
  29. locator = new ActiveXObject("WbemScripting.SWbemLocator");
  30. }
  31. catch(e)
  32. {
  33. }
  34. if(locator == null)
  35. alert("Unable to create WMI object");
  36. else
  37. UseLocator(locator)
  38. }
  39. </SCRIPT>
  40. </BODY>
  41. </HTML>