Powershell Get-VM,名称不像

Jer*_*ust 2 powershell vmware

我正在尝试运行Get-VM并按名称过滤掉一些VM。

例如,Get-VM | 名称与“ Web1”和“ Web2”不同

我该怎么做?

或类似的东西?但这行不通

Get-VM -Name -notlike WEBIMAGE1,WEBIMAGE2
Run Code Online (Sandbox Code Playgroud)

dot*_*tom 5

将您的输出通过管道Get-VM传递到Where-Object

Get-VM | Where-Object { $_.Name -notlike '*Web1*' -and $_.Name -notlike '*Web2*'}
Run Code Online (Sandbox Code Playgroud)