2 Replies Latest reply on Jan 31, 2017 7:00 AM by homerjnick

    PowerCLI - Get-View @Filter with multiple criteria?

    homerjnick Enthusiast

      I have a script that I run after I update our Linked Clones .  The script runs through VM's for a Resource Pool and creates three scheduled tasks that shutdown, then power off then power on VM's.


      Part of my code I have is this:


      Get-View -ViewType VirtualMachine -Filter @{"ResourcePool" = "MYRESOURCEPOOL"}


      And from I create the scheduled tasks in a For statement.


      Instead of creating different scripts or rerunning the thing for other Resource Pools I would prefer to filter the view but refer to multiple Resource Pools.


      So something like:


      Get-View -ViewType VirtualMachine -Filter @{"ResourcePool" = "MYRESOURCEPOOL1", "MYRESOURCEPOOL2"}

      But I can't seem to get the right syntax to filter on multiple resource pools.


      Can anyone assist?