Select just one Objects table of metadata for object

Welcome Forums General PowerShell Q&A Select just one Objects table of metadata for object

This topic contains 3 replies, has 3 voices, and was last updated by

1 week, 5 days ago.

  • Author
  • #126975

    Points: 71
    Rank: Member

    I've run this for a User object:

    Get-ADReplicationAttributeMetadata -Object "CN=MyUserObject,DC=corp,DC=com" `
        -Server DC1 -ShowAllLinkedValues

    ...and get all the metadata but how do I select just one of those attributes and it's corresponding metadata?

    i.e. AttributeName : whenCreated ?

    I've tried various Select's, -expandProperty etc but not getting errors or output


  • #127001

    Points: 1
    Rank: Member

    Hi Jeff,

    The output of Get-ADReplicationAttributeMetadata contains multiple Attributes with the same names and values. you can verify this by piping the output to Get-Member so you cannot do a select-object direct from the pipeline you need to iterate through the output into the attribute Name ( $_.AttributeName.WhenCreated ) and then search

    try the below

    Get-ADReplicationAttributeMetadata -Object "CN=Test201,OU=Users,OU=Accounts,OU
    =lab,DC=zerobyte,DC=local" -ShowAllLinkedValues -server "test.test.local" | Where-Object {
    $_.AttributeName -eq "whenCreated"} | Select-Object AttributeValue


    • #127007

      Points: 71
      Rank: Member

      perfect thanks Spietersz

  • #127079

    Points: 819
    Helping Hand
    Rank: Major Contributor

    We can use the inbuilt filter option for this.

    Get-ADReplicationAttributeMetadata -Object 'CN=MyUserObject,DC=corp,DC=com' -Server DC1 -Filter "AttributeName -eq 'WhenCreated'" | Select-Object AttributeValue

You must be logged in to reply to this topic.