How To Configure a PowerShell Custom Action that Grants Permissions to Administrators and No Other Users
This article discusses how to configure a PowerShell custom action that grants permissions to Administrators and no other users.
1. Configure a PowerShell custom action that calls the following PowerShell cmdlet:
Invoke-Expression -Command:"icacls 'C:\Program Files\Permission' /inheritance:r /grant Administrators:F"
2. Set In-Script Execution to Immediate Execution.
3. Sequence the custom action in the Install Exec Sequence After InstallFinalize with the following Install Exec Condition:
See the attached sample project for more details. In this case, the PowerShell custom action sets the permissions on INSTALLDIR.
Click here for the official Microsoft documentation, an introduction to PowerShell.
Click here for the official Microsoft documentation about the Invoke-Expression PowerShell cmdlet.
Click here for the official Microsoft documentation about the icacls Windows command called by the PowerShell custom action.