SetSecurityOnRegistryKey
(
RegistryKey As String,
[Machine] As Variant
);
Parameters
[in] String RegistryKey
Complete path of the RegistryKey on which security is to be
set.
Description
Stamps the security permissions of the current registry key on the
registry key specified by the RegistryKey parameter.
Remarks
This method may be used to replicate security permissions of an
attached registry key on multiple registry keys.
Example
Dim ObjSec As IObjectSecurity
Dim strRegKeyPath1 As String
Dim strRegKeyPath2 As String
strRegKeyPath1 = "HKEY_LOCAL_MACHINE\SOFTWARE\SOURCE"
strRegKeyPath2 = "HKEY_LOCAL_MACHINE\SOFTWARE\DESTINATION"
Set ObjSec = CreateObject("DirectScript.ObjectSecurity")
'Read the security of the Source registry key
ObjSec.AttachRegistryKey strRegKeyPath1, "MachineName", True
'Stamp or write the security of the currently attached
registrykey
'to the destination key.
ObjSec.SetSecurityOnRegistryKey strRegKeyPath2, "MachineName"
See Also