Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Consider the following PowerShell commands around failover clustering:

Get-ClusterGroup "UKMAC-XA54" | Get-ClusterResource

The first cmdlet returns a single ClusterGroup object with the fields Name, OwnerNode & State.

Get-ClusterResource, if left to it's own devices, would return information about all resources in the cluster.

However, when used in the pipeline, there is obviously some filtering going on.

My question is "How does this filtering work?". How does PowerShell know to use the OwnerNode field from Get-ClusterGroup to filter Get-ClusterResource? There is a "Name" field return in both cmdlets, why doesn't it filter on "Name"? (which wouldn't actually work).

A link to a reference on this subject would be great.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The piped objects (the one/ones returned by the Get-ClusterGroup call) will be passed as -InputObject to the Get-ClusterResource cmdlet. You can see this if you read the help on the -InputObject parameter, where it states that the parameter accepts pipeline input (by value).

The documentation on the -InputObject parameter further states that it "Specifies the cluster node or cluster group to enumerate cluster resources on." Which means that the filtering is done based on the objects passed into this parameter.

I suggest reading the help section on how the pipeline works, which you can get it you run:

Get-Help about_Pipelines

And you can read detailed help on your Get-ClusterResource cmdlet, to see which parameters accepts pipeline input (and whether they accept it by value or by name, which you can read more about in the help section about pipelines) if your run:

Get-Help Get-ClusterResource -Full
share|improve this answer
    
Thanks - -InputObject was the hole in my understanding –  Rob Nicholson Feb 14 at 14:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.