# Security_SetDirPermissions

> Sets access right for a trustee on a directory.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/security-functions/security-setdirpermissions/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Sets access right for a trustee on a directory

sRight can be one of the following values:

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

### **Notes:**

Some names of Trustees has been localized, such as Power Users. In these cases you have to use the SID. If bIncludeSubDirs has been set to True, the parameter sDir will change to sDir & "\*" e.g. from C:\Temp to C:\Temp\*  
If more than one access right needs to be applied the values must be added in the same sRight string e.g. "RW" to obtain Read and Write access on the Directory.

### Syntax

Security_SetDirPermissions(sDir, sTrustee, sRight, bIncludeSubDirs) As Boolean

### Parameters

#### sDir (String)

Name of the Directory

#### sTrustee (String)

A trustee is a user or group. Trustee can either be "Domainname/username" or a [Well-known SID's](/capainstaller/vb-scripting-library/addendum/well-known-sid-s/) (Security Identifier)

#### sRight (String)

Access Right that should be set

#### bIncludeSubDirs (Boolean)

Include subdirectories (True/False)

### Example

**VBScript**

```vb
If bStatus Then bStatus = Security_SetDirPermissions(gsProgramFiles & "\CapaInstaller\Logs","S-1-5-4", "F", True)
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[Security functions](/capainstaller/vb-scripting-library/security-functions/) [Security_DenyDirAccess](/capainstaller/vb-scripting-library/security-functions/security-denydiraccess/) [Security_RevokeDirPermissions](/capainstaller/vb-scripting-library/security-functions/security-revokedirpermissions/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
