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.

45 lines
1.0 KiB

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