RegistrySetting.SetValue Method (String, ICollection, RegistryValueKind)
Configures the registry setting with a Binary (REG_BINARY) or MultiString (REG_MULTI_SZ) value that has the specified value name and value data.
Namespace: Microsoft.GroupPolicy
Assembly: Microsoft.GroupPolicy.Management.Interop (in Microsoft.GroupPolicy.Management.Interop.dll)
Syntax
public void SetValue(
string name,
ICollection value,
RegistryValueKind valueKind
)
public:
void SetValue(
String^ name,
ICollection^ value,
RegistryValueKind valueKind
)
member SetValue :
name:string *
value:ICollection *
valueKind:RegistryValueKind -> unit
Public Sub SetValue (
name As String,
value As ICollection,
valueKind As RegistryValueKind
)
Parameters
name
Type: System.StringThe value name. Specify an empty string (“”) or null for the default value.
value
Type: System.Collections.ICollectionA collection that holds the value data.
valueKind
Type: Microsoft.Win32.RegistryValueKindOne of the RegistryValueKind enumeration values that specifies the data type for the registry value. Only Binary and MultiString are supported.
Exceptions
Exception | Condition |
---|---|
ArgumentOutOfRangeException | valueKind is not a supported RegistryValueKind enumeration value. |
InvalidCastException | valueKind is equal to MultiString and any of the elements in the collection specified by the value parameter cannot be cast to String. -or- valueKind is equal to Binary and any of the elements in the collection specified by the value parameter cannot be cast to IConvertible. -or- valueKind is equal to Binary and any of the elements in the collection specified by the value parameter are a DateTime type. |
OverflowException | The data type of an element in the specified ICollection object is one of the following data types, and its value is less than MinValue or greater than MaxValue. |
FormatException | The data type of an element in the specified ICollection object is a string, and its value does not consist of an optional sign followed by a sequence of digits (zero through nine). |
See Also
SetValue Overload
RegistrySetting Class
Microsoft.GroupPolicy Namespace
Return to top