Folder Permissions with Powershell error

Welcome Forums General PowerShell Q&A Folder Permissions with Powershell error

This topic contains 3 replies, has 3 voices, and was last updated by

1 year, 8 months ago.

  • Author
  • #71404

    Points: 0
    Rank: Member

    Hi Guys,

    I'm quite new to powershell and trying to use the Get-ACL and set-acl cmdlets to change a folder permission on a new folder.

    i have set a $paste for the username so for example would be jack.smith

    i am trying to create the folder with
    FileSystemRights : DeleteSubdirectoriesAndFiles, Modify, Synchronize
    AccessControlType : Allow
    IdentityReference : USERNAME
    IsInherited : False
    InheritanceFlags : ContainerInherit, ObjectInherit
    PropagationFlags : None

    but i get an error when trying to create a permissions object like below:

    PS C:\Users\xxxxx> $Perms = New-Object
    New-Object : Cannot find an overload for "FileSystemAccessRule" and the argumen
    t count: "6".
    At line:1 char:20
    + $Perms = New-Object < <<<
        + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodExcept
        + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
    any help would be great!
  • #71408

    Points: 157
    Helping Hand
    Rank: Participant

    Check out Rohn Edwards's PowerShell Access Control module, it automates a lot of what could be tedious to do manually with the native cmdlets..

    • #71419

      Points: 0
      Rank: Member

      Done it! thanks for the suggestion, it seems overly complicated compared to the module you linked me to 🙂

  • #71429

    Points: 0
    Rank: Member

    The problem you are having is some of the parameters to the FileSystemAccessRule constructor are a collection and you don't have them together (e.g., 'ContainerInherit','ObjectInherit' vs. 'ContainerInherit, ObjectInherit')

    Try using this code snippet instead:

    $Perms = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList (
    'ContainerInherit, ObjectInherit',

The topic ‘Folder Permissions with Powershell error’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort