I want to use vbscript (or some scripting language I can run locally on a windows 7 machine) and change a registry key's permissions.
I saw regini, but it's old, and I didn't see how to use it for my needs. Specifically, as an example, I need to add:
nt service\BFE
to the HKLM\currentcontrolset\services\bfe\parameters\policy
. Then I have to use advanced, add bfe, then use specific permissions such as set, read, query value, delete, but not full control.
How can I do this programmatically with a scripting language?
Thanks.
With regini.exe.
So I won't be able to set Users Full Control, but Everyone Full Control.
See the following articles for details on the values used in the regini script:
And here you have the VBScript that will use regini.exe and its script:
' Create a temp file with the script that regini.exe will use
'
set oFSO = CreateObject("Scripting.FileSystemObject")
strFileName = oFSO.GetTempName
set oFile = oFSO.CreateTextFile(strFileName)
oFile.WriteLine "HKEY_LOCAL_MACHINE\Software\Classes\AlejaCMaTypelib [1 5 7 11 17]"
oFile.WriteLine "HKEY_LOCAL_MACHINE\Software\AlejaCMaCo\AlejaCMaApp [1 5 7 11 17]"
oFile.Close
' Change registry permissions with regini.exe
'
set oShell = CreateObject("WScript.Shell")
oShell.Run "regini " & strFileName, 8, true
' Delete temp file
'
oFSO.DeleteFile strFileName
WScript.Echo "Done!"