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.

29 lines
1.0 KiB

  1. '***************************************************************************
  2. 'This script tests the execution of a method using XML/HTTP
  3. '***************************************************************************
  4. On Error Resume Next
  5. Dim objLocator
  6. Set objLocator = CreateObject("WbemScripting.SWbemLocator")
  7. ' Replace the first argument to this function with the URL of your WMI XML/HTTP server
  8. ' For the local machine, use the URL as below
  9. Dim objService
  10. Set objService = objLocator.ConnectServer("[http://localhost/cimom]", "root\cimv2")
  11. ' Get the class/instance on which you wish to execute the method
  12. Set process = objService.Get("Win32_Process")
  13. ' Create the arguments for method execution
  14. set startupinfo = objService.Get("Win32_ProcessStartup")
  15. set instance = startupinfo.SpawnInstance_
  16. instance.Title = "Foo Bar"
  17. result = process.Create ("notepad.exe",,instance,processid)
  18. WScript.Echo "Method returned result = " & result
  19. WScript.Echo "Id of new process is " & processid
  20. if err <>0 then
  21. WScript.Echo Err.Description
  22. end if