I went through the reference links you provided and that was helpful. I decided to go with PowerShell way of setting the permissions.
Is there any PSADT specific function to set folder and file permissions?
If you can give couple of example scripts you created before to set permissions inside the PSADT that helps
There aren’t any PSADT specific functions to set file and folder permissions. Here is an example from one of my scripts to set folder permissions:
##If it does not exist create the C:\Program Files\Your Program folder and allow all users. #Create folder (will continue if folder exists) $dirYourProgram = "$envProgramFiles\Your Program" New-Folder -Path $dirYourProgram
#Add User permissions to Epic Games folder. If (Test-Path $dirYourProgram) { Write-Log -Message 'Updating ACL for C:\Program Files\Your Program...' #Define the permission rule we want to add to the File/Folder. In this case add Users and AllowFullControl $rule=new-object System.Security.AccessControl.FileSystemAccessRule ("BUILTIN\Users","FullControl","ContainerInherit,ObjectInherit","None","Allow")
#Get the existing ACL for the File/Folder we want to change permissions on. $FolderACL = Get-ACL -Path $dirYourProgram
#Add the new permission rule to the existing File/Folder ACL $FolderACL.SetAccessRule($rule)
#Set the updated ACL on the File/Folder Set-ACL -Path $dirYourProgram -AclObject $FolderACL }
This example will create the folder if it doesnt already exist and add the Users group with full control. If there are existing files/folders in the program folder they will inherit the settings from the parent folder.
I am looking to log the modify permission applied successfully. Could you please let me know on How to log it once appliced via Set ACL?
On what basis we have to Write-log ? is the below script is correct?
I have tried but couldn’t see permission applied successfully or error message it just says Performing the operation “Set-Acl” on target "C:\Program Files (x86)\ThinkMedia 2.0".* Below PSADT log though the permission were applied successfully upon checking manually