I have a strange behavior when I try to count how much drivers are connected to a workstation.
PS C:\WINDOWS> get-disk | select number, size
number size
------ ----
0 512110190592
1 1000204886016
PS C:\WINDOWS> (get-disk | select number, size).count
2
So far, so good. Now, I'm going to filter it down to select my smallest drive
PS C:\WINDOWS> get-disk | Where-Object { $_.Size -lt 600GB } | select number, size
number size
------ ----
0 512110190592
PS C:\WINDOWS> (get-disk | Where-Object { $_.Size -lt 600GB } | select number, size).count
Where is my count? Shouldn't it return 1? It is working fine with other collections of one:
PS C:\WINDOWS> (get-process).count
196
PS C:\WINDOWS> (get-process powershell_ise ).count
1
Is it an issue with my disks object type?
PS C:\WINDOWS> Get-Disk |gm
TypeName: Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk
Much confusion in my brain now!
Anyone has an idea what could go wrong there?