Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Where clause not excluding results?

$
0
0

Good Morning All,

I am attempting to write a script that targets virtual machines that do not have a VMXNET3 network adapter and are not part of a specified list of names but for some reason my line of code is not working and I cannot understand why - the full list of VMs is printed?


$ExcludedList = 'VM1','VM2','VM3'
Get-VM | Get-NetworkAdapter | Where {($_.Type -ne "Vmxnet3") -or ($_.Parent.Name -notcontains $ExcludedList)} | Select @{N="VM";E={$_.Parent.Name}}

Thanks for any help you can provide. 


Viewing all articles
Browse latest Browse all 6937

Trending Articles