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

 
Senior Moderator
8 months, 4 weeks ago.

  • Author
    Posts
  • #126975

    Participant
    Topics: 114
    Replies: 244
    Points: 131
    Rank: Participant

    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

    Thanks

  • #127001

    Participant
    Topics: 5
    Replies: 33
    Points: 4
    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
    
    

    Regards

    • #127007

      Participant
      Topics: 114
      Replies: 244
      Points: 131
      Rank: Participant

      perfect thanks Spietersz

  • #127079

    Senior Moderator
    Topics: 8
    Replies: 1009
    Points: 3,281
    Helping Hand
    Rank: Community Hero

    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
    

The topic ‘Select just one Objects table of metadata for object’ is closed to new replies.