Relative Content

Tag Archive for windowspowershellserver

Why i can’t set permissions on a folder in my windows server?

if (-not (Test-Path “\SRV-1Disco$homePath”)){ $NewFolder = New-Item -Path “\SRV-1Disco” -Name $homePath -ItemType “Directory” $folderPath = “\SRV-1Disco$homePath” $user = “ARZANI$($e.’username’)” # Get the current ACL (Access Control List) $acl = Get-Acl $folderPath # Define the new permission rule (FullControl in this example) $permission = “FullControl” $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($user, $permission, “ContainerInherit, ObjectInherit”, “None”, “Allow”) # Add […]