Script to retrieve deny permissions - Required
Hi,
I have given Deny permissions ( for Administrators ) to registries during installation, during uninstallation I need to revoke the permissions to delete those keys. Could any1 write a script/INFfile to revoke the permissions.
Ex: HKLM\Software\Adobe
Thanks
sanhivi
I have given Deny permissions ( for Administrators ) to registries during installation, during uninstallation I need to revoke the permissions to delete those keys. Could any1 write a script/INFfile to revoke the permissions.
Ex: HKLM\Software\Adobe
Thanks
sanhivi
0 Comments
[ + ] Show comments
Answers (10)
Please log in to answer
Posted by:
anonymous_9363
15 years ago
Could any1 write a script/INFfile to revoke the permissions.Yes, they could. I charge by the hour for scripting so, if you'd like to discuss likely costs, PM me. To give me an idea of how long it might take, can you tell me what tool you used to set the permissions? You mention INF file so I guess it was SecEdit?
Posted by:
anonymous_9363
15 years ago
Posted by:
concept03
15 years ago
Why don't you simply use the open-source executable "SetAcl.exe" from a script? Your original post was not very descriptive about what you are looking for. However, here are some examples for securing, and unsecuring a registry key.
You can download SetAcl from here: http://sourceforge.net/project/showfiles.php?group_id=69165&package_id=68032
'
On Error Resume Next
dim machineName 'NetBIOS Name of the Machine.
dim wshNetwork 'Network Scripting Object.
dim wshShell 'Shell Access.
set wshNetwork = WScript.CreateObject("WScript.Network")
set wshShell = WScript.CreateObject("WScript.Shell")
machineName = wshNetwork.ComputerName
'Gives access only for Administrators (Read + Set), and Everyone (Read) - not inherited.
Secure "HKLM\Software\Adobe"
'This resets the key to default settings (of parent key)
UnSecure "HKLM\Software\Adobe"
'*----------------------------------------------------------------------------*
sub Secure(key)
'Access only for Administrators (Read + Set), and Everyone (Read) - not inherited.
WScript.Echo "Securing " & key & "..."
wshShell.Run "setacl -on """ & key & """ -ot reg -actn ace -ace ""n:" & machineName & "\Administrators;p:query_val,enum_subkeys,notify,write_dacl,write_owner,read_access""", 0, true
wshShell.Run "setacl -on """ & key & """ -ot reg -actn ace -ace ""n:Everyone;p:query_val,enum_subkeys,notify,read_access""", 0, true
wshShell.Run "setacl -on """ & key & """ -ot reg -actn setprot -op dacl:p_nc", 0, true end sub
'*----------------------------------------------------------------------------*
'*----------------------------------------------------------------------------*
sub UnSecure(key)
' Set Inheritence on - clear non-inherited ACEs
WScript.Echo "UnSecuring " & key & "..."
wshShell.Run "setacl -on """ & key & """ -ot reg -actn setprot -op dacl:np", 0, true
wshShell.Run "setacl -on """ & key & """ -ot reg -actn clear -clr dacl,sacl", 0, true end sub
'*----------------------------------------------------------------------------*
'
You can download SetAcl from here: http://sourceforge.net/project/showfiles.php?group_id=69165&package_id=68032
On Error Resume Next
dim machineName 'NetBIOS Name of the Machine.
dim wshNetwork 'Network Scripting Object.
dim wshShell 'Shell Access.
set wshNetwork = WScript.CreateObject("WScript.Network")
set wshShell = WScript.CreateObject("WScript.Shell")
machineName = wshNetwork.ComputerName
'Gives access only for Administrators (Read + Set), and Everyone (Read) - not inherited.
Secure "HKLM\Software\Adobe"
'This resets the key to default settings (of parent key)
UnSecure "HKLM\Software\Adobe"
'*----------------------------------------------------------------------------*
sub Secure(key)
'Access only for Administrators (Read + Set), and Everyone (Read) - not inherited.
WScript.Echo "Securing " & key & "..."
wshShell.Run "setacl -on """ & key & """ -ot reg -actn ace -ace ""n:" & machineName & "\Administrators;p:query_val,enum_subkeys,notify,write_dacl,write_owner,read_access""", 0, true
wshShell.Run "setacl -on """ & key & """ -ot reg -actn ace -ace ""n:Everyone;p:query_val,enum_subkeys,notify,read_access""", 0, true
wshShell.Run "setacl -on """ & key & """ -ot reg -actn setprot -op dacl:p_nc", 0, true end sub
'*----------------------------------------------------------------------------*
'*----------------------------------------------------------------------------*
sub UnSecure(key)
' Set Inheritence on - clear non-inherited ACEs
WScript.Echo "UnSecuring " & key & "..."
wshShell.Run "setacl -on """ & key & """ -ot reg -actn setprot -op dacl:np", 0, true
wshShell.Run "setacl -on """ & key & """ -ot reg -actn clear -clr dacl,sacl", 0, true end sub
'*----------------------------------------------------------------------------*
'
Posted by:
concept03
15 years ago
Posted by:
Nouman
15 years ago
Posted by:
anonymous_9363
15 years ago
Posted by:
Nouman
15 years ago
Posted by:
AngelD
15 years ago
Posted by:
anonymous_9363
15 years ago
Do you understand how Windows permissions work?
Typically, for a folder, the 'Administrators' group would be assigned 'Full Control' as would the local System account, 'Power Users' would probably have all bar 'Full Control' and 'Users' would have 'Read' only. For any file in that folder (presuming - as is the default - that the folder's permissions were set to inherit those from the folder) with that set of permissions, clearly, only a member of the 'Administrators' group or the local System account would be able to delete it.
Typically, for a folder, the 'Administrators' group would be assigned 'Full Control' as would the local System account, 'Power Users' would probably have all bar 'Full Control' and 'Users' would have 'Read' only. For any file in that folder (presuming - as is the default - that the folder's permissions were set to inherit those from the folder) with that set of permissions, clearly, only a member of the 'Administrators' group or the local System account would be able to delete it.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.