PowerShell To Set Folder Permissions

前端 未结 5 835
旧时难觅i
旧时难觅i 2020-12-05 12:35

I am trying to use the \"default\" options in applying folder permissions; by that, I mean that using the \"Full Controll, Write, Read, etc\" in the \'Properties\' for a fol

5条回答
  •  悲&欢浪女
    2020-12-05 13:18

    Another example using PowerShell for set permissions (File / Directory) :

    Verify permissions

    Get-Acl "C:\file.txt" | fl *
    

    Apply full permissions for everyone

    $acl = Get-Acl "C:\file.txt"
    $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl","Allow")
    $acl.SetAccessRule($accessRule)
    $acl | Set-Acl "C:\file.txt"
    

    Screenshots:

    Hope this helps

提交回复
热议问题