Dumb question, but I'm looking to find all VMs that have "cust.cats.com" in it (usually a server will have something likeDCAD01.cust.cats.com) and only report on them. I have the below which doesn't seem to work. Anyone know how to achieve this?
$WindowsVMS = get-view -viewtype virtualmachine -property 'name','guest.guestFamily' -filter @{'guest.GuestFamily'='windowsGuest';'Runtime.PowerState'='poweredOn';'name'='*.cust.cats.com$'}
Your RegEx expression was nearly correct, just that the quantifier (*) comes after the any character symbol(.)
$WindowsVMS = Get-View -ViewType virtualmachine -Property 'name','guest.guestFamily' -Filter @{'guest.GuestFamily'='windowsGuest';'Runtime.PowerState'='poweredOn';'name'='.*cust.cats.com$'}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Your RegEx expression was nearly correct, just that the quantifier (*) comes after the any character symbol(.)
$WindowsVMS = Get-View -ViewType virtualmachine -Property 'name','guest.guestFamily' -Filter @{'guest.GuestFamily'='windowsGuest';'Runtime.PowerState'='poweredOn';'name'='.*cust.cats.com$'}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks dude, works a charm!