Need help getting the Where-Object filter in the right place

Hello

I'm trying to filter local data warehouses, but I do not get the expected results.

Code:

Get-Datastore. Select @{N = "MON"; E={$_. Name}},

@{N = "Total virtual machines"; E={@($_ | Get - VM). County}} |

Where-Object {$_Name-Notlike "Datastore1 *"}

Thank you

Advertisement

As a general rule, you want to first filter when it is possible for greater efficiency in the pipeline.  Which is no exception here:

Try:

Get-Datastore. Where-Object {$_Name-Notlike "Datastore1 *"} |

Select @{N = "MON"; E={$_. Name}}, @{N = "Total virtual machines"; E={@($_ | Get - VM). County}}

Tags: VMware

Similar Questions

Maybe you are looking for

  • iPad-pro iOS 9.3.2 OTA update bricking My 9.7 inches

    Now I really wan to learn how an ipsw no clear data downgrade to ios 9.3.1.I I forgot to save my ipad before I update. Thank you very much.

  • Re: Satellite L350-145 - keyboard does not properly

    Hello I came here hoping that someone might be able to help. Suddenly, some time ago my keyboard started to behave a bit strange. The arrows of the cursor type letters rather than direct me to the top or the bottom of a page (letters hkl instead of c

  • No sound on my Satellite L40 - 17R

    I have a problem with the audio drivers. I installed the drivers correctly but got the message no devices mixer in the Task Manager.Everything works well including sound devices What should I do? Please, I beg you. help!

  • 4510 error with freeridegames.exe

    freeridegames.exeRemember - this is a public forum so never post private information such as numbers of mail or telephone! Ideas: You have problems with programs Error messages Recent changes to your computer What you have already tried to solve the

  • CM1415fnw - reset password

    Like the fool I am, I put a password for this device (home network) and can't come with her.  We had changes to our ISP, so I need to adhere to the printer on a different network, but to face the password at every turn. How can I perform a reset of t