MR_HPE
Contributor
Contributor

Match wildcard in -filter

Hello all,

I realize this is likely a very simple question, but I can't come up with an answer. I need to pull a list of VM's using Get-View with the '-filter' option, but having trouble with the correct Regex expression.

I.e, get-view –viewtype VirtualMachine -filter @{'Name' = '^((*$Cluster*).)*$'} 

Where $Cluster would be the cluster name, providing only the VM's for that specific cluster. The expression above returns no VMs.

 

Thanks.

 

Reply
0 Kudos