title: Compare System.Version in Powershell
body: <p>I have a case where I have to make a decision in script based on comparing versions
  Consider this example:  </p>
  
  <pre><code>PS C:\&gt;
  [version]$SomeVersion='1.1.1'
  [version]$OtherVersion='1.1.1.0'
  
  PS C:\&gt; $SomeVersion
  
  Major  Minor  Build  Revision
  -----  -----  -----  --------
  1      1      1      -1      
  
  PS C:\&gt; $OtherVersion
  
  Major  Minor  Build  Revision
  -----  -----  -----  --------
  1      1      1      0       
  
  PS C:\&gt;$SomeVersion -ge $OtherVersion
  False
  </code></pre>
  
  <p>I would like to omit revision when comparing objects of type System.Version<br>
  I Can't find any sane way of doing that.<br>
  Is there any? </p>
  
  <p>Note - I've tried doing :</p>
  
  <pre><code>PS C:\&gt; ($scriptversion |select major,minor,build) -gt ($currentVersion|select major,minor,build)
  
  Cannot compare "@{Major=1; Minor=1; Build=1}" to "@{Major=1; Minor=1; 
  Build=1}" because the objects are not the same type or the object "@{Major=1; 
  Minor=1; Build=1}" does not implement "IComparable".
  At line:1 char:1
  + ($scriptversion |select major,minor,build) -gt ($currentVersion |sele ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
  + FullyQualifiedErrorId : PSObjectCompareTo
  </code></pre>
  
  <p>when I try to override revision number with 0 it says that it's read-only property... 
  I have a workaround But I hoped to do it better with system.version</p>