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.

71 lines
1.6 KiB

  1. Option Explicit
  2. Sub Main
  3. Dim oGroup
  4. Dim oCluster
  5. Dim oResource
  6. Dim sCluster
  7. Set oCluster = CreateObject("MSCluster.Cluster") 'Create the Cluster object
  8. sCluster = InputBox( "Cluster to open?" )
  9. oCluster.Open( sCluster )
  10. AddGroup oCluster, oGroup 'Create or open the group
  11. AddResource oGroup, oResource 'Create or open the resource
  12. oResource.Online 10 'Bring the resource online and wait for up to 10 seconds for it to come online
  13. Sleep 10
  14. oResource.Offline 10 'Take the resource offline and wait for up to 10 seconds for it to offline
  15. Sleep 5
  16. oResource.Delete 'Delete the resource
  17. Sleep 5
  18. oGroup.Delete 'Delete the group
  19. End Sub
  20. '
  21. ' This subroutine will create or open the group
  22. '
  23. Sub AddGroup( oCluster, oGroup )
  24. Set oGroup = oCluster.ResourceGroups.CreateItem("High Availability NotePad")
  25. End Sub
  26. '
  27. ' This subroutine will add the resource to the group
  28. '
  29. Sub AddResource(oGroup, oResource)
  30. Dim oGroupResources
  31. Dim oProperties
  32. Dim oCLProperty
  33. Dim oCDProperty
  34. Set oGroupResources = oGroup.Resources
  35. Set oResource = oGroupResources.CreateItem("NotePad", "Generic Application", 0) 'CLUSTER_RESOURCE_DEFAULT_MONITOR
  36. Set oProperties = oResource.PrivateProperties
  37. Set oCLProperty = oProperties.CreateItem("CommandLine", "notepad")
  38. Set oCDProperty = oProperties.CreateItem("CurrentDirectory", "c:\")
  39. oProperties.SaveChanges
  40. End Sub
  41. Sub Sleep(PauseTime)
  42. Dim Start
  43. Start = Timer
  44. Do While Timer < Start + PauseTime
  45. Loop
  46. End Sub
  47. Main