PowerCLI move Multiple VM’s to a VM Folder

$DestinationVC = “.

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

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

Translate »
%d bloggers like this: