windows-nt/Source/XPSP1/NT/base/cluster/admin/msclus/wsf/test5.wsf
2020-09-26 16:20:57 +08:00

75 lines
1.6 KiB
XML

<job id="Cluster Private Properties">
<reference guid="{f2e606e0-2631-11d1-89f1-00a0c90d061e}" version="1.0" />
<script language="VBScript">
Option explicit
RunTest
Sub RunTest
'On Error Resume Next
Dim oCluster
Dim varValue
Dim collRegistryKeys
Set oCluster=CreateObject( "MSCluster.Cluster" )
oCluster.Open( "GALENB-CLUS" )
oCluster.ResourceTypes.CreateItem "8testRes", "8testRes", "testRes.dll", 5000, 60000
if err.Number <> 0 then
MsgBox "Create resource type error Error: " & Err.Description
Exit Sub
end if
Dim oResource
'Dim count
'count = oCluster.Resources.Count
'if err.Number <> 0 then
' MsgBox "Get count Error: " & Err.Description
' err.Clear
'end if
set oResource = oCluster.Resources.CreateItem( "8TestResource", "8testRes", "Cluster Group",0)
Dim index
Dim rCount
Dim key
Dim keyString
Set collRegistryKeys = oResource.RegistryKeys
rCount = collRegistryKeys.Count
if err.Number <> 0 then
MsgBox "Error: " & Err.Description
Exit Sub
else
MsgBox "Get RegistryKeys collection succeeded: " & oResource.Name & " Count= " & rCount
end if
'keyString = "Cluster" & "\" & oResource.Name & "Key"
keyString = "Software\TestKey"
collRegistryKeys.AddItem keyString
if err.Number <> 0 then
MsgBox "Error: " & Err.Description
err.Clear
else
MsgBox "AddRegistryKeys succeeded. Count= " & collRegistryKeys.Count
end if
'collRegistryKeys.Refresh
'MsgBox "AddRegistryKeys.Count= " & collRegistryKeys.Count
'collRegistryKeys.RemoveItem collRegistryKeys.count
collRegistryKeys.RemoveItem 1
MsgBox "Done."
End sub
</script>
</job>