Hello Albert,
In order to achieve that, we will make use of the
"Access Control List (ACL)". Here is a PowerShell script that will set the registry permissions as per your needs:
Code: Select all
# gets the access control list and store it in the $acl variable
$acl = Get-Acl "HKLM:\SOFTWARE\MyKey"
# the NTAccount Class represents a user or a group account. In our case, we
# need to make use of the "BuiltIn\Users" account.
$users = [System.Security.Principal.NTAccount]"BuiltIn\Users"
# the RegistryRights Enumeration specifies the access control rights
# that can be applied to registry objects.
$access = [System.Security.AccessControl.RegistryRights]"SetValue"
# the Inheritance flags specify the semantics
# of inheritance for access control entries (ACEs).
$inheritance = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit,ObjectInherit"
# the PropagationFlags Enumeration specifies how access control entries (ACEs)
# are propagated to child objects.
$propagation = [System.Security.AccessControl.PropagationFlags]"None"
# the AccessControlType Enumeration specifies whether an AccessRule object is used
# to allow or deny access.
$type = [System.Security.AccessControl.AccessControlType]"Allow"
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($users, $access,$inheritance, $propagation, $type)
$acl.AddAccessRule($rule)
$acl |Set-Acl
The above can be added in your project as a
"Run PowerShell inline script" custom action. The custom action should be added after the
"Add Resources" action group, because the action that creates the registry\ies specified in the "Registry" page (
"WriteRegistryValues" is part of the "Add resources" action group).
The
"Execution TIme" for your custom action should be of
"When the system is being modified (deferred)" and the
"Execution Options" should be as it follows:
- Run under the LocalSystem account with full privileges (no impersonation) -->
ticked
- Wait for custom action to finish before proceeding -->
ticked
- Fail installation if custom action returns an error -->
ticked
Also, you can make your custom action to only execute during the Install process by unchecking the "Uninstall" and "Maintenance" options from under the
"Execution Stage Condition" section.
set the permissions on both the 64-bit registry and the WOW6432Node registry in 64-bit OS and 32-bit OS?
This can be done from within your script settings. If you plan on changing the permissions for a registry whose component is of 64-bit (
does not write its value under WOW6432NODE), then you can tick the
"64-bit script" option which is located to the right side of the
"Parameters" field.
In the following lines, you'll find attached a sample project for your reference.
The above project creates two registry keys, with the same name, under both SOFTWARE and SOFTWARE\WOW6432NODE and then the two scripts change the key's permissions.
Also, you can have a look on the following
"RegistryAccessRule(String, RegistryRights, InheritanceFlags, PropagationFlags, AccessControlType)" article which I think you may find useful.
Also, the bug fix does not appear in 12.5.1 release notes, because it was actually fixed in 12.5:
https://www.advancedinstaller.com/release-12.5.html
I apologize for the inconvenience.
Hope this helps.
All the best,
Catalin
FOLLOW US
Get the latest news in Application Packaging