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.

95 lines
3.6 KiB

  1. on error resume next
  2. 'First pass - on mutable object
  3. WScript.Echo "************************"
  4. WScript.Echo "PASS 1 - SWbemObjectPath"
  5. WScript.Echo "************************"
  6. WScript.Echo ""
  7. Set Path = CreateObject("WbemScripting.SWbemObjectPath")
  8. WScript.Echo "Expect """""
  9. WScript.Echo """" & Path.DisplayName & """"
  10. WScript.Echo ""
  11. Path.DisplayName = "winmgmts:root/cimv2:Win32_Wibble.Name=10,Zip=7"
  12. WScript.Echo "Expect no security info"
  13. WScript.Echo Path.DisplayName
  14. WScript.Echo ""
  15. Path.DisplayName = "winmgmts:{impersonationLevel=impersonate}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  16. WScript.Echo "Expect ""{impersonationLevel=impersonate}!"""
  17. WScript.Echo Path.DisplayName
  18. WScript.Echo ""
  19. Path.DisplayName = "winmgmts:{authenticationLevel=connect,impersonationLevel=impersonate}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  20. WScript.Echo "Expect ""{authenticationLevel=connect,impersonationLevel=impersonate}!"""
  21. WScript.Echo Path.DisplayName
  22. WScript.Echo ""
  23. Path.DisplayName = "winmgmts:{impersonationLevel=identify,authenticationLevel=call}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  24. WScript.Echo "Expect ""{authenticationLevel=call,impersonationLevel=identify}!"""
  25. WScript.Echo Path.DisplayName
  26. WScript.Echo ""
  27. Path.DisplayName = "winmgmts:{authenticationLevel=default}!root/cimv2:Win32_Wibble.Name=10,Zip=7"
  28. WScript.Echo "Expect ""{authenticationLevel=default}!"""
  29. WScript.Echo Path.DisplayName
  30. WScript.Echo ""
  31. Path.DisplayName = "winmgmts:{authenticationLevel=none}!"
  32. WScript.Echo "Expect ""{authenticationLevel=none}"""
  33. WScript.Echo Path.DisplayName
  34. WScript.Echo ""
  35. Path.DisplayName = "winmgmts:{authenticationLevel=call}"
  36. WScript.Echo "Expect ""{authenticationLevel=call}"""
  37. WScript.Echo Path.DisplayName
  38. WScript.Echo ""
  39. Path.DisplayName = "winmgmts:{authenticationLevel=pkt,impersonationLevel=delegate}!"
  40. WScript.Echo "Expect ""{authenticationLevel=pkt,impersonationLevel=delegate}"""
  41. WScript.Echo Path.DisplayName
  42. WScript.Echo ""
  43. Path.DisplayName = "winmgmts:{authenticationLevel=pktIntegrity,impersonationLevel=identify}"
  44. WScript.Echo "Expect ""{authenticationLevel=pktIntegrity,impersonationLevel=identify}"""
  45. WScript.Echo Path.DisplayName
  46. WScript.Echo ""
  47. Path.DisplayName = "winmgmts:{authenticationLevel=pktPrivacy,impersonationLevel=identify}!root/default"
  48. WScript.Echo "Expect ""{authenticationLevel=pktPrivacy,impersonationLevel=identify}"""
  49. WScript.Echo Path.DisplayName
  50. WScript.Echo ""
  51. Path.DisplayName = "winmgmts:{authenticationLevel=pktPrivacy,impersonationLevel=identify}!root/default:__Cimomidentification=@"
  52. WScript.Echo "Expect ""{authenticationLevel=pktPrivacy,impersonationLevel=identify}"""
  53. WScript.Echo Path.DisplayName
  54. WScript.Echo ""
  55. Path.DisplayName = "winmgmts:{impersonationLevel=anonymous}!"
  56. WScript.Echo "Expect ""{impersonationLevel=anonymous}"""
  57. WScript.Echo Path.DisplayName
  58. WScript.Echo ""
  59. Path.DisplayName = "winmgmts:{impersonationLevel=anonymous}"
  60. WScript.Echo "Expect ""{impersonationLevel=anonymous}"""
  61. WScript.Echo Path.DisplayName
  62. WScript.Echo ""
  63. 'Seconc pass - on object path
  64. WScript.Echo "**************************"
  65. WScript.Echo "PASS 2 - SWbemObject.Path_"
  66. WScript.Echo "**************************"
  67. WScript.Echo ""
  68. Set Object = GetObject("winmgmts:win32_logicaldisk")
  69. WScript.Echo "Expect ""{authenticationLevel=pktPrivacy,impersonationLevel=identify}"""
  70. WScript.Echo Object.Path_.DisplayName
  71. WScript.Echo ""
  72. Object.Security_.ImpersonationLevel = 3
  73. WScript.Echo "Expect ""{authenticationLevel=pktPrivacy,impersonationLevel=impersonate}"""
  74. WScript.Echo Object.Path_.DisplayName
  75. if err <> 0 then
  76. WScript.Echo Err.Description, Err.Number, Err.Source
  77. end if