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.

49 lines
1.4 KiB

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