VMware Cloud Community
ImaRelic
Contributor
Contributor
Jump to solution

Get-Catalog | Where-Object

I am a rookie, don't understand what I am doing wrong.

When I use Get-Catalog -MyOrgOnly it returns all of the my catalogs.

When I use Get-Catalog -MyOrgOnly | Where-Object  and then anything, nothing ever gets returned.

For example, I think Get-Catalog -MyOrgOnly | Where -Object  -Property Name -contains 'EE2'  should return more than one catalog. Nothing is ever returned.

I would be very appreciative if someone would tell me what I am doing wrong.

 

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The -Contains operator expects an array on the left operand.
The pipeline presents one object at the time to the Where-clause, so no array.
You could try

Get-Catalog -MyOrgOnly | Where-Object {$_.Name -match 'EE2'}

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

1 Reply
LucD
Leadership
Leadership
Jump to solution

The -Contains operator expects an array on the left operand.
The pipeline presents one object at the time to the Where-clause, so no array.
You could try

Get-Catalog -MyOrgOnly | Where-Object {$_.Name -match 'EE2'}

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference