Preventing users from creating subfolders

mara2021 1,181 Reputation points
2024-01-30T13:47:37.53+00:00

I have a powershell script that prevents users from creating subfolders on a list of folders. Inheritance is disabled on the folders. I am getting the following message when I run the script: cmdlet New-Object at command pipeline position 1 Supply values for the following parameters: TypeName: The script is below. What am I missing to cause this message? Thanks. User's image

Windows for business | Windows Server | User experience | PowerShell
{count} votes

Answer accepted by question author
  1. MotoX80 37,156 Reputation points
    2024-01-30T14:16:14.9433333+00:00

    Combine lines 22 and 23.

    $accessRule = new-object System.Security.AccessControl.FileSystemAccessRule $permission
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.