Skip to content

Security_SetFilePermissions

Sets access right for a trustee on a file.

sRight can be one of the following values:

  • F: Full Control
  • C: Change
  • R: Read
  • X: Execute
  • E: Read Execute
  • W: Write
  • D: Delete

Security_SetFilePermissions(sFile, sTrustee, sRight) As Boolean

Full path of the file

A trustee is a user or group. The trustee can be a name in the format Domain\User or a well-known SID (security identifier). Some built-in group names, such as Power Users, are localized, so use the SID for those.

Access right to set. To set more than one right, combine the letters in one string, for example "RW".

The function returns False if SubInACL.exe can’t be found, or if SubInACL reports an error. See Security functions for where the library looks for SubInACL.exe.

If bStatus Then bStatus = Security_SetFilePermissions(gsProgramFiles & "\CapaInstaller\CapaInstaller.bat", "S-1-5-4", "F")

Scripting Guidelines

Security functions Security_DenyFileAccess Security_RevokeFilePermissions Constants Package Property Variables