PowerCLI move Multiple VM’s to a VM Folder

$DestinationVC = 20;.

Connect-VIServer $DestinationVC

#Optie 1

$vmfolder = “Applicatie Servers”

$tempvms = Get- | where {$_. -match ‘vm’}

foreach ($tempvm in $tempvms){

$DestinationHost = Get-VM $tempvm | Get-VMhost

-VM $tempvm - $vmfolder -Destination $DestinationHost -ErrorAction Stop

}

#Optie 2

# Get-VM | where {$_.Folder -match ‘vm’} | Move-VM -InventoryLocation “Diverse Applicatie Servers”