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.

231 lines
8.0 KiB

  1. dim objSWbemLocator
  2. dim objSWbemServices
  3. dim objSWbemObjectSet
  4. dim objSWbemObject
  5. dim objSWbemObject2
  6. dim objSWbemObject3
  7. dim objSWbemObjectPath
  8. dim objSWbemProperty
  9. dim objSWbemPropertySet
  10. dim objSWbemMethod
  11. dim objSWbemMethodSet
  12. dim objSWbemLastError
  13. dim objSWbemNamedValueSet
  14. dim objSWbemSink
  15. dim InParameters
  16. dim NewParameters
  17. dim rc
  18. dim Temp
  19. dim CRLF
  20. dim Keys
  21. dim Names
  22. dim value
  23. dim NTEvent
  24. const WBEM_NO_ERROR = 0
  25. const wbemErrFailed = -2147217407
  26. const wbemErrNotFound = -2147217406
  27. const wbemErrAccessDenied = -2147217405
  28. const wbemErrProviderFailure = -2147217404
  29. const wbemErrTypeMismatch = -2147217403
  30. const wbemErrOutOfMemory = -2147217402
  31. const wbemErrInvalidContext = -2147217401
  32. const wbemErrInvalidParameter = -2147217400
  33. const wbemErrNotAvailable = -2147217399
  34. const wbemErrCriticalError = -2147217398
  35. const wbemErrInvalidStream = -2147217397
  36. const wbemErrNotSupported = -2147217396
  37. const wbemErrInvalidSuperclass = -2147217395
  38. const wbemErrInvalidNamespace = -2147217394
  39. const wbemErrInvalidObject = -2147217393
  40. const wbemErrInvalidClass = -2147217392
  41. const wbemErrProviderNotFound = -2147217391
  42. const wbemErrInvalidProviderRegistration = -2147217390
  43. const wbemErrProviderLoadFailure = -2147217389
  44. const wbemErrInitializationFailure = -2147217388
  45. const wbemErrTransportFailure = -2147217387
  46. const wbemErrInvalidOperation = -2147217386
  47. const wbemErrInvalidQuery = -2147217385
  48. const wbemErrInvalidQueryType = -2147217384
  49. const wbemErrAlreadyExists = -2147217383
  50. const wbemErrOverrideNotAllowed = -2147217382
  51. const wbemErrPropagatedQualifier = -2147217381
  52. const wbemErrPropagatedProperty = -2147217380
  53. const wbemErrUnexpected = -2147217379
  54. const wbemErrIllegalOperation = -2147217378
  55. const wbemErrCannotBeKey = -2147217377
  56. const wbemErrIncompleteClass = -2147217376
  57. const wbemErrInvalidSyntax = -2147217375
  58. const wbemErrNondecoratedObject = -2147217374
  59. const wbemErrReadOnly = -2147217373
  60. const wbemErrProviderNotCapable = -2147217372
  61. const wbemErrClassHasChildren = -2147217371
  62. const wbemErrClassHasInstances = -2147217370
  63. const wbemErrQueryNotImplemented = -2147217369
  64. const wbemErrIllegalNull = -2147217368
  65. const wbemErrInvalidQualifierType = -2147217367
  66. const wbemErrInvalidPropertyType = -2147217366
  67. const wbemErrValueOutOfRange = -2147217365
  68. const wbemErrCannotBeSingleton = -2147217364
  69. const wbemErrInvalidCimType = -2147217363
  70. const wbemErrInvalidMethod = -2147217362
  71. const wbemErrInvalidMethodParameters = -2147217361
  72. const wbemErrSystemProperty = -2147217360
  73. const wbemErrInvalidProperty = -2147217359
  74. const wbemErrCallCancelled = -2147217358
  75. const wbemErrShuttingDown = -2147217357
  76. const wbemErrPropagatedMethod = -2147217356
  77. const wbemErrUnsupportedParameter = -2147217355
  78. const wbemErrMissingParameter = -2147217354
  79. const wbemErrInvalidParameterId = -2147217353
  80. const wbemErrNonConsecutiveParameterIds = -2147217352
  81. const wbemErrParameterIdOnRetval = -2147217351
  82. const wbemErrInvalidObjectPath = -2147217350
  83. const wbemErrOutOfDiskSpace = -2147217349
  84. const wbemErrRegistrationTooBroad = -2147213311
  85. const wbemErrRegistrationTooPrecise = -2147213310
  86. const wbemErrTimedout = -2147209215
  87. const wbemFlagReturnImmediately = 16
  88. const wbemFlagReturnWhenComplete = 0
  89. const wbemFlagBidirectional = 0
  90. const wbemFlagForwardOnly = 14
  91. const wbemFlagNoErrorObject = 28
  92. const wbemFlagReturnErrorObject = 0
  93. const wbemFlagSendStatus = 128
  94. const wbemFlagDontSendStatus = 0
  95. const wbemCimtypeSint8 = 16
  96. const wbemCimtypeUint8 = 17
  97. const wbemCimtypeSint16 = 2
  98. const wbemCimtypeUint16 = 18
  99. const wbemCimtypeSint32 = 3
  100. const wbemCimtypeUint32 = 19
  101. const wbemCimtypeSint64 = 20
  102. const wbemCimtypeUint64 = 21
  103. const wbemCimtypeReal32 = 4
  104. const wbemCimtypeReal64 = 5
  105. const wbemCimtypeBoolean = 11
  106. const wbemCimtypeString = 8
  107. const wbemCimtypeDatetime = 101
  108. const wbemCimtypeReference = 102
  109. const wbemCimtypeChar16 = 103
  110. const wbemCimtypeObject = 13
  111. const wbemAuthenticationLevelDefault = 0
  112. const wbemAuthenticationLevelNone = 1
  113. const wbemAuthenticationLevelConnect = 2
  114. const wbemAuthenticationLevelCall = 3
  115. const wbemAuthenticationLevelPkt = 4
  116. const wbemAuthenticationLevelPktIntegrity = 5
  117. const wbemAuthenticationLevelPktPrivacy = 6
  118. const wbemImpersonationLevelAnonymous = 1
  119. const wbemImpersonationLevelIdentify = 2
  120. const wbemImpersonationLevelImpersonate = 3
  121. const wbemImpersonationLevelDelegate = 4
  122. on error resume next
  123. CRLF = Chr(13) & Chr(10)
  124. WScript.Echo "WBEM Script Started"
  125. '***********************************************************************
  126. '*
  127. '* WbemSink_OnObjectPut
  128. '*
  129. '***********************************************************************
  130. sub WbemSink_OnObjectPut(pObject, pAsyncContext)
  131. dim context
  132. WScript.Echo "OnObjectPut CallBack Called"
  133. end sub
  134. '***********************************************************************
  135. '*
  136. '* WbemSink_OnProgress
  137. '*
  138. '***********************************************************************
  139. sub WbemSink_OnProgress(liUpperBound, liCurrent, sMessage, pAsyncContext)
  140. dim context
  141. WScript.Echo "OnProgress CallBack Called"
  142. end sub
  143. '***********************************************************************
  144. '*
  145. '* WbemSink_OnCompleted
  146. '*
  147. '***********************************************************************
  148. sub WbemSink_OnCompleted(hResult, pErrorObject, pAsyncContext)
  149. WScript.Echo "OnCompleted CallBack Called [", hResult, "]"
  150. end sub
  151. '***********************************************************************
  152. '*
  153. '* WbemSink_OnObjectReady
  154. '*
  155. '***********************************************************************
  156. sub WbemSink_OnObjectReady(pObject, pAsyncContext)
  157. WScript.Echo "OnObjectReady CallBack Called: ", pObject.Path_.RelPath
  158. end sub
  159. '***********************************************************************
  160. '*
  161. '*
  162. '*
  163. '***********************************************************************
  164. Set objSWbemLocator = nothing
  165. Set objSWbemLocator = WScript.CreateObject("WbemScripting.SWbemLocator")
  166. if err.number <> 0 then
  167. ErrorString err.number, "Set objSWbemLocator = WScript.CreateObject('WbemScripting.SWbemLocator')","create a locator"
  168. end if
  169. '***********************************************************************
  170. '*
  171. '*
  172. '*
  173. '***********************************************************************
  174. Set objSWbemServices = nothing
  175. Set objSWbemServices = objSWbemLocator.ConnectServer(,"root\cimv2")
  176. if err.number <> 0 then
  177. ErrorString err.number, "Set objSWbemServices = objSWbemLocator.ConnectServer(,'root\cimv2')","connect to server"
  178. end if
  179. '***********************************************************************
  180. '*
  181. '*
  182. '*
  183. '***********************************************************************
  184. Set objSWbemSink = WScript.CreateObject("WbemScripting.SWbemSink","WbemSink_")
  185. if err.number <> 0 then
  186. ErrorString err.number, "Set objSWbemSink = WScript.CreateObject('WbemScripting.SWbemSink','WbemSink_')","create a sink"
  187. end if
  188. '***********************************************************************
  189. '*
  190. '*
  191. '*
  192. '***********************************************************************
  193. objSWbemServices.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
  194. WScript.Echo objSWbemServices.Security_.ImpersonationLevel
  195. '***********************************************************************
  196. '*
  197. '*
  198. '*
  199. '***********************************************************************
  200. 'AssociatorsOfAsync(objAsyncNotify As Object, strObjectPath As String, [strAssocClass As String], [strResultClass As String], [strResultRole As String], [strRole As String], [bClassesOnly As Boolean = False], [bSchemaOnly As Boolean = False], [strRequiredAssocQualifier As String], [strRequiredQualifier As String], [iFlags As Long], [objNamedValueSet As Object], [objAsyncContext As Object])
  201. objSWbemServices.AssociatorsOfAsync objSWbemSink, "Win32_service.Name=""NetDDE""", ,,,,,,,,wbemFlagSendStatus
  202. if err.number <> 0 then
  203. WScript.Echo err.number, "objSWbemServices.AssociatorsOfAsync 'Win32_service.Name=''NetDDE''', objSWbemSink","create a sink"
  204. end if
  205. WScript.Echo "WBEM Script Hanging"
  206. WScript.Quit