I'm testing in a Windows Failover cluster environment. Below is my code.
PS C:\Users\administrator.DEV> Get-ClusterResource *disk*
Name State OwnerGroup ResourceType
---- ----- ---------- ------------
Cluster Disk 1 Online Available Storage Physical Disk
Cluster Disk 2 Online Cluster Group Physical Disk
Cluster Disk 3 Online Available Storage Physical Disk
PS C:\Users\administrator.DEV> (Get-ClusterResource *disk*).GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
PS C:\Users\administrator.DEV> (Get-ClusterResource *disk*)[0].GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False ClusterResource Microsoft.FailoverClusters.PowerShell.ClusterObject
PS C:\Users\administrator.DEV>
As you can see, I have three disk resource. But when I want to get the first one with the select
cmdlet, I got empty output.
PS C:\Users\administrator.DEV> Get-ClusterResource *disk* | select -First 1
PS C:\Users\administrator.DEV>
Why this behavior? How can I get the first disk resource in this case?