2 Replies Latest reply on Dec 6, 2018 7:35 PM by RSullivanDuke

    How to locate Excluded Attributes using PowerShell?

    RSullivanDuke

      I'm unable to retrieve Excluded Attributes using the normal methods in PowerShell.

      I am able to retrieve the correct number of attributes for an element in an array, however once I trim the list down any further it will filter out the excluded attributes... for example:

      PS C:\> $af_template = Get-AFElementTemplate $template_name -AFDatabase $afcon
      PS C:\> $elements = $af_template.Elements
      PS C:\> $elements[0].Attributes.Count
      74
      PS C:\> $attributes = $elements[0].Attributes
      PS C:\> $attributes.Count
      74
      PS C:\> $attributes.Name.Count
      45
      
      
      

       

      I'm able to query the IsExcluded directly within the $attributes array..

      PS C:\> $attributes[60].IsExcluded
      True
      PS C:\> $attributes[73].IsExcluded
      False
      

       

      ..but I can't pass any in bulk. For example, the following gives me nothing:

      $attributes = $elements[0].Attributes | ? {$_.IsExcluded -eq $True}
      

       

      Is there an easy solution here that I am missing?

      Thanks.