ClusProperties.UseDefaultValue method
[The UseDefaultValue method is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]
Used in conjunction with ClusProperties.SaveChanges to return a property to its default value.
Syntax
ClusProperties.UseDefaultValue( _
ByVal varIndex _
)
Parameters
-
varIndex
-
A Variant specifying a property by name or by numeric index.
Return value
This method does not return a value.
Remarks
UseDefaultValue works in conjunction with ClusProperties.SaveChanges as follows.
- UseDefaultValue sets the value of the property in the collection to empty and flags the property as "use default."
- When the SaveChanges method is invoked, any property in the collection flagged as "use default" is not written to the cluster database. Instead, SaveChanges method clears the property value stored in the cluster database, causing the property to revert to its the hard-coded default value.
- If SaveChanges is successful, it automatically calls ClusProperties.Refresh, which reads the default value from the cluster database into the collection.
The hard-coded default value of a property is defined by the Cluster service or by a resource DLL. The Cluster Properties reference section documents each of the properties defined by the Cluster service, including their default values.
The ClusProperties.Refresh method clears the "use default" flag without affecting cluster database.
Examples
The following example uses UseDefaultValue to set all of an object's properties to their default values.
Option Explicit
Public Function RestoreDefaults(obj)
Dim objProp
Dim strOut
For Each objProp in obj.CommonProperties
objProp.UseDefaultValue
Next
objProp.CommonProperties.SaveChanges
For Each objProp in obj.PrivateProperties
objProp.UseDefaultValue
Next
objProp.PrivateProperties.SaveChanges
For Each objProp in objProp.CommonProperties
strOut = strOut & objProp.Name & " = " & CStr(objProp.Value) & _
vbCrLf
Next
For Each objProp in objProp.CommonProperties
strOut = strOut & objProp.Name & " = " & CStr(objProp.Value) & _
vbCrLf
Next
WScript.Echo strOut
Set objProp = Nothing
End Function
Requirements
Minimum supported client |
None supported |
Minimum supported server |
Windows Server 2008 Enterprise, Windows Server 2008 Datacenter |
Header |
|
IDL |
|
Type library |
|
DLL |
|
IID |
IID_ISClusProperties is defined as F2E60700-2631-11D1-89F1-00A0C90D061E |