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.

138 lines
3.3 KiB

  1. '----------------------------------------
  2. ' test.vbs
  3. ' ~~~~~~~~
  4. ' This script lists all of the object in
  5. ' the cluster and their properties.
  6. ' It uses bugtool.exe to allow
  7. ' OuputDebugString from vbs
  8. '----------------------------------------
  9. Dim Log
  10. Set Log = CreateObject( "BugTool.Logger" )
  11. Log.Write "Starting Cluster Test" & vbCRLF
  12. Main
  13. Log.Write "Ending Cluster Test" & vbCRLF
  14. Sub Main
  15. On Error Resume Next
  16. '----------------------------------------
  17. ' Open the cluster
  18. '----------------------------------------
  19. Dim Cluster
  20. Set Cluster = CreateObject( "MSCluster.Cluster" )
  21. Cluster.Open( "stacyh1" )
  22. '----------------------------------------
  23. ' This is the kind of error checking you
  24. ' will need throughout VBSCRIPT code.
  25. '----------------------------------------
  26. If Err.Number <> 0 Then
  27. Log.Write "Unable to open the cluster" & vbCRLF
  28. Log.Write "Error " & Hex(Err.Number) & ": " & Err.Description & vbCRLF
  29. Exit Sub
  30. End If
  31. Log.Write "Cluster Name = " & Cluster.Name & vbCRLF
  32. '----------------------------------------
  33. ' Quick test for variant type convert...
  34. '----------------------------------------
  35. Dim oNode
  36. Set oNode = Cluster.Nodes("1")
  37. Log.Write "Node ID = " & oNode.NodeID & vbCRLF
  38. '----------------------------------------
  39. ' Start the whole thing!
  40. '----------------------------------------
  41. ListNodes Cluster
  42. End Sub
  43. '--------------------------------------
  44. ' List Nodes
  45. '--------------------------------------
  46. Sub ListNodes( Cluster )
  47. Dim Nodes
  48. Set Nodes = Cluster.Nodes
  49. Dim Node
  50. Dim nIndex
  51. For nIndex = 1 to Nodes.Count
  52. Set Node = Nodes( nIndex )
  53. Log.Write "Node Name = " & Node.Name & vbCRLF
  54. ListGroups Node
  55. Next
  56. End Sub
  57. '--------------------------------------
  58. ' List Groups
  59. '--------------------------------------
  60. Sub ListGroups( Node )
  61. Dim Groups
  62. Set Groups = Node.ResourceGroups
  63. Dim Group
  64. Dim nIndex
  65. For nIndex = 1 to Groups.Count
  66. Set Group = Groups( nIndex )
  67. Log.Write "Group Name = " & Group.Name & vbCRLF
  68. ListResources Group
  69. Next
  70. End Sub
  71. '--------------------------------------
  72. ' List Resources
  73. '--------------------------------------
  74. Sub ListResources( Group )
  75. Dim Resources
  76. Set Resources = Group.Resources
  77. Dim Resource
  78. Dim nIndex
  79. For nIndex = 1 To Resources.Count
  80. Set Resource = Resources( nIndex )
  81. Log.Write "Resource Name = " & Resource.Name & vbCRLF
  82. ListProperties Resource
  83. Next
  84. End Sub
  85. '--------------------------------------
  86. ' List Properties
  87. '--------------------------------------
  88. Sub ListProperties( Resource )
  89. Dim Properties
  90. Dim Property
  91. Dim nIndex
  92. '------------------------------
  93. ' Common Properties
  94. '------------------------------
  95. Set Properties = Resource.CommonProperties
  96. Log.Write "Common Properties for " & Resource.Name & vbCRLF
  97. For nIndex = 1 To Properties.Count
  98. Set Property = Properties(nIndex)
  99. Log.Write vbTab & Property.Name & " = " & Property.Value & vbCRLF
  100. Next
  101. '------------------------------
  102. ' Private Properties
  103. '------------------------------
  104. Set Properties = Resource.PrivateProperties
  105. Log.Write "Private Properties for " & Resource.Name & vbCRLF
  106. For nIndex = 1 To Properties.Count
  107. Set Property = Properties(nIndex)
  108. Log.Write vbTab & Property.Name & " = " & Property.Value & vbCRLF
  109. Next
  110. End Sub