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.

50 lines
1.4 KiB

  1. on error resume next
  2. while true
  3. set service = GetObject ("winmgmts://ludlow/root/cimv2")
  4. 'PASS 1 - identify
  5. WScript.Echo ">>Pass 1: ", service.Security_.impersonationLevel
  6. set processes = service.ExecQuery ("select Name from Win32_Process","WQL",0)
  7. if err <> 0 then
  8. WScript.Echo "Got error as expected:", err.Number, err.description, err.source
  9. err.clear
  10. end if
  11. 'PASS 2 - anonymous
  12. service.Security_.impersonationlevel = 1
  13. WScript.Echo ">> Pass 2: ", service.Security_.impersonationLevel
  14. set processes = service.ExecQuery ("select Name from Win32_Process","WQL",0)
  15. if err <> 0 then
  16. WScript.Echo "Got error as expected:", err.Number, err.description, err.source
  17. err.clear
  18. end if
  19. 'PASS 2 - impersonate
  20. service.Security_.impersonationlevel = 3
  21. WScript.Echo ">> Pass 2: ", service.Security_.impersonationLevel
  22. set processes = service.ExecQuery ("select Name from Win32_Process","WQL",0)
  23. if err <> 0 then
  24. WScript.Echo "Got error:", err.Number, err.description, err.source
  25. err.clear
  26. else
  27. WScript.Echo "OK"
  28. end if
  29. 'PASS 3 - delegate
  30. service.Security_.impersonationlevel = 4
  31. WScript.Echo ">> Pass 2: ", service.Security_.impersonationLevel
  32. set processes = service.ExecQuery ("select Name from Win32_Process","WQL",0)
  33. if err <> 0 then
  34. WScript.Echo "Got error:", err.Number, err.description, err.source
  35. err.clear
  36. else
  37. WScript.Echo "OK"
  38. end if
  39. wend