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.

48 lines
1.1 KiB

  1. On Error Resume Next
  2. while true
  3. Set E = GetObject ("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
  4. ("select Name from Win32_Processs", "WQL", 0)
  5. if Err <> 0 Then
  6. WScript.Echo "Expected error was raised:", Err.Source, Err.Number, Err.Description
  7. Err.Clear
  8. end if
  9. for each Process in E
  10. if Err <> 0 Then
  11. 'Create the last error object
  12. set t_Object = CreateObject("WbemScripting.SWbemLastError")
  13. WScript.Echo ""
  14. WScript.Echo "WBEM Last Error Information:"
  15. WScript.Echo ""
  16. WScript.Echo " Operation:", t_Object.Operation
  17. WScript.Echo " Provider:", t_Object.ProviderName
  18. strDescr = t_Object.Description
  19. strPInfo = t_Object.ParameterInfo
  20. strCode = t_Object.StatusCode
  21. if (strDescr <> nothing) Then
  22. WScript.Echo " Description:", strDescr
  23. end if
  24. if (strPInfo <> nothing) Then
  25. WScript.Echo " Parameter Info:", strPInfo
  26. end if
  27. if (strCode <> nothing) Then
  28. WScript.Echo " Status:", strCode
  29. end if
  30. Err.Clear
  31. Else
  32. WScript.Echo "Shouldn't get here!"
  33. End if
  34. next
  35. wend