Get disks count via powershell
<p>I have a strange behavior when I try to count how much drivers are connected to a workstation. </p>

<pre><code>PS C:\WINDOWS&gt; get-disk | select number, size

number          size
------          ----
 0  512110190592
 1 1000204886016

PS C:\WINDOWS&gt; (get-disk | select number, size).count
2
</code></pre>

<p>So far, so good. Now, I'm going to filter it down to select my smallest drive</p>

<pre><code>PS C:\WINDOWS&gt; get-disk | Where-Object { $_.Size -lt 600GB } | select number, size

number         size
------         ----
 0 512110190592

PS C:\WINDOWS&gt; (get-disk | Where-Object { $_.Size -lt 600GB } | select number, size).count
</code></pre>

<p>Where is my count? Shouldn't it return 1? It is working fine with other collections of one:</p>

<pre><code>PS C:\WINDOWS&gt; (get-process).count
196

PS C:\WINDOWS&gt; (get-process powershell_ise ).count
1
</code></pre>

<p>Is it an issue with my disks object type?</p>

<pre><code>PS C:\WINDOWS&gt; Get-Disk |gm

TypeName: Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk
</code></pre>

<p>Much confusion in my brain now!</p>

<p>Anyone has an idea what could go wrong there?</p>