title: Getting unique elements from a column returns one value
body: <p>I have the following function defined in a ps1 file, using the DLL from the <a href="https://www.nuget.org/packages/TagLibSharp/2.2.0#" rel="nofollow noreferrer">latest taglib release</a>. I downloaded the nuget package and ran <code>expand-archive</code> on it and copied the DLL to the correct place.</p>
  <pre><code>
  [System.Reflection.Assembly]::LoadFrom((Resolve-Path ($PSScriptRoot + &quot;\TagLibSharp.dll&quot;)))
  function Get-Image {
      [CmdletBinding()]
      param (
          [Parameter(ValueFromPipelineByPropertyName)] $Name
      )
  
      process {
          $fullPath = (Resolve-Path $Name).Path
          $image = [taglib.file]::create($fullpath)
  
          return $image
      }
  }
  
  function Get-ImmediatePhotos {
      Get-ChildItem | Where-Object  {$_.Extension -eq &quot;.jpg&quot; -or $_.Extension -eq &quot;.png&quot;} | Get-Image
  }
  
  </code></pre>
  <p>When I run this command to extract the years from the EXIF data in photos in a given directory I get a table like this:</p>
  <pre><code>&gt; $years = Get-ImmediatePhotos | select-object {$_.Tag.DateTime.Year}
  &gt; $years
  $_.Tag.DateTime.Year
  --------------------
                  2020
                  2020
                  2020
                  2020
                  2020
                  2020
                  2020
                  2020
                  2020
                  2020
                  2021
                  2021
                  2021
                  2021
  </code></pre>
  <p>If I then try to extract unique years with <code>sort-object</code> I only get one year!</p>
  <pre><code>&gt; $years | sort-object -unique
  
  $_.Tag.DateTime.Year
  --------------------
                  2020
  </code></pre>
  <p>If I try to group years with <code>group-object</code> I get this error:</p>
  <pre><code>$years | group-object
  Group-Object: Cannot compare &quot;@{$_.Tag.DateTime.Year=2020}&quot; to
  &quot;@{$_.Tag.DateTime.Year=2020}&quot; because the objects are not the same type or the object 
  &quot;@{$_.Tag.DateTime.Year=2020}&quot; does not implement &quot;IComparable&quot;.
  </code></pre>
  <p>This seems to be telling me that the type of values in the column are some sort of anonymous thing which can't be compared.</p>
  <p>How do I use the results of select as values, such as strings?  My end goal is to automatically sort and categorize photos into directories in <code>/year/month</code> format.</p>