Create a folder and give it specific permissions

Create a folder and give it specific permissions

This powershell script check of the folder exist and if not create the folder and give it specific permissions.

###
$path = "C:\Program Files (x86)\MetaVision\logs"
# Check if the folder exists, and create it if it doesn't
if (-not (Test-Path -Path $path)) {
    New-Item -Path $path -ItemType Directory
}
$path = "C:\Program Files (x86)\MetaVision\logs"; $user = "eproclab2\~username"; $permission = "fullcontrol"; $acl = Get-Acl -Path $path; $rule = New-Object System.Security.AccessControl.FileSystemAccessRule($user, $permission, "ContainerInherit,ObjectInherit", "None", "Allow"); $acl.SetAccessRule($rule); Set-Acl -Path $path -AclObject $acl
###

Before runing this command you need to change the: 
1.     "C:\Program Files (x86)\MetaVision\logs" to your path.
2.      "C:\Program Files (x86)\MetaVision\logsto your path.
3.      The domain name "eproclab2" to your domain.
4.      The level of the permission you want to give.

To download the command click here.
Once downlod complete, import it throw the import option in the Custom command section.

For any additional information, please contact support@eprocsolutions.com