Missing object properties

Welcome Forums General PowerShell Q&A Missing object properties

Viewing 1 reply thread
  • Author
    Posts
    • #114628
      Participant
      Topics: 1
      Replies: 0
      Points: 26
      Rank: Member

      The following command returns an object for the folder ACL

      Get-Acl -Path $env:TEMP

      The object type is System.Security.AccessControl.DirectorySecurity
      MS Docs lists amongst other properties AccessRulesModified and AuditRulesModified. With Get-Members i find the methodes ModifyAccessRule and ModifyAuditRule, but not the mentioned properties:

      Get-Acl -Path $env:TEMP | Get-Member -Name '*modify*' -force
      
         TypeName: System.Security.AccessControl.DirectorySecurity
      Name             MemberType Definition                                                                                   
      ----             ---------- ----------                                                                                   
      ModifyAccessRule Method     bool ModifyAccessRule(System.Security.AccessControl.AccessControlModification modification...
      ModifyAuditRule  Method     bool ModifyAuditRule(System.Security.AccessControl.AccessControlModification modification,...
      

      How can i access the missing properties?

    • #114787
      Participant
      Topics: 2
      Replies: 510
      Points: 1,301
      Helping Hand
      Rank: Community Hero

      As you can see from the documentation pages on those particular properties, these are not public properties, they are protected — this means that only the object itself or objects inheriting from this type can access these properties.

      https://docs.microsoft.com/en-us/dotnet/api/system.security.accesscontrol.objectsecurity.accessrulesmodified?view=netframework-4.7.2#System_Security_AccessControl_ObjectSecurity_AccessRulesModified

      They are not missing, merely hidden and tucked away because they aren't intended to be accessible. 🙂

Viewing 1 reply thread
  • The topic ‘Missing object properties’ is closed to new replies.