Powershell - How to filter out objects in a list which are present in another list?


i have loop runs, , has 1 object containing list of virtual machines (this vmware stuff):

$vmlist = get-vm

after point, user chooses vms list , things them, , these vms appended list each time so:

$vmhistory += $chosenvms

after loop around start:

$vmlist = get-vm

what want @ point, filter out $vmlist of virtual machines in $vmhistory object. i've tried:

$vmlist = get-vm | where-object {$_.name -notlike $vmhistory.name} 

but doesn't work. dont know how use where-object filter list list.

try changing -notlike -notin.


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL