about the puzzle 8 solution

This topic contains 0 replies, has 1 voice, and was last updated by  js 2 months, 2 weeks ago.

  • Author
    Posts
  • #95649

    js
    Participant

    You can set multiple enum flags like this: (I got it from http://www.latkin.org/blog/2012/07/08/using-enums-in-powershell/) (Although it comes out as 'Modify, Synchronize')

    $acl = Get-Acl -Path C:\SpecialFolder\SpecialFile.txt
    $user = 'BillB' 
    $rights = [System.Security.AccessControl.FileSystemRights]'ReadAndExecute, Write, Modify, Read'  # enum flags
    $rights
    
    Modify
    
    $RuleBillB = [System.Security.AccessControl.FileSystemAccessRule]::new($user, $rights, 'Allow') 
    $RuleBillB
    
    FileSystemRights  : Modify, Synchronize
    AccessControlType : Allow
    IdentityReference : BillB
    IsInherited       : False
    InheritanceFlags  : None
    PropagationFlags  : None
    
    $acl.AddAccesssRule($RuleBillB)
    Set-Acl -Path C:\SpecialFolder\SpecialFile.txt -AclObject $acl
    

    Btw, amazing that any user can still write to places like C:\ and C:\ProgramData.

You must be logged in to reply to this topic.