title: Where-Object : Cannot bind parameter 'FilterScript'
body: <p>I have one problem with two questions. I have following powercli cmd:</p>
  
  <pre><code>$snapLst = Get-VM vmindev |Get-Snapshot |Select VM, Name, Description, `
   @{Name='Created'; Expression={{$_.Created.ToString("yyMMdd")}}, `
   @{Name='SizeMB'; Expression={[int] $_.SizeMB}}
  $resultLst=$snapLst| where SizeMB -gt 1000 |Sort-Object SizeMB |`
   Select @{Name='Type'; Expression={'BIG'}},*
  </code></pre>
  
  <p>When run in my DEV env (powercli session on my desktop connecting to the vSphere sever), everything is fine. When run in PRODUCTION (ie. powercli session on the vSphere server), I get the following error:</p>
  
  <pre><code>Where-Object : Cannot bind parameter 'FilterScript'. Cannot convert the "SizeMB" value of type "System.String" to type System.Management.Automation.ScriptBlock".
      At C:\Users\kness\Scripts\sn2.ps1:32 char:27
      + $resultLst=$snapLst| where &lt;&lt;&lt;&lt;  SizeMB -gt 1000 |Sort-Object SizeMB |Select
      @{Name='Type'; Expression={'BIG'}},
          + CategoryInfo          : InvalidArgument: (:) [Where-Object], ParameterBindingException
          + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WhereObjectCommand
  </code></pre>
  
  <p>Q1: What - in the environment setup - would make the script behaves differently? I checked the versions of the powercli ... they're exactly the same.</p>
  
  <p>Q2: Because the above error, I look into the property of the list by running this cmd:</p>
  
  <pre><code>$snapLst = Get-VM vmindev |Get-Snapshot |Get-Member |Findstr Size
  SizeGB            Property   System.Nullable`1[[System.Decimal, mscorlib, Ve...
  SizeMB            Property   System.Decimal SizeMB {get;}
  </code></pre>
  
  <p><p>SizeMB is a "decimal" type; why the error complains that it is a "string"?</p>
  
  <p>Thx in advance!</p>