Script to convert 100+ servers from Thick to Thin Format or whatever format you want.
LucDCorrect Answer
by LucD on May 28, 2015 5:19 AM
Try like this, it will only select VMs that have at least 1 Thick vdisk.
Connect-viserver vcenter.domain.tld
$sourcedatastore = “SOURCEDATASTORE“
$destinationdatastore = “DESTINATIONDATASTORE“
$vms = Get-VM -Datastore $sourcedatastore | where{(Get-HardDisk -VM $_ ).StorageFormat -contains 'Thick'}
foreach($vm in $vms){
Move-VM -VM (Get-VM -Name $vm) -Datastore $destinationdatastore -DiskStorageFormat thin
}
by LucD on May 28, 2015 5:19 AM
Try like this, it will only select VMs that have at least 1 Thick vdisk.
Connect-viserver vcenter.domain.tld
$sourcedatastore = “SOURCEDATASTORE“
$destinationdatastore = “DESTINATIONDATASTORE“
$vms = Get-VM -Datastore $sourcedatastore | where{(Get-HardDisk -VM $_ ).StorageFormat -contains 'Thick'}
foreach($vm in $vms){
Move-VM -VM (Get-VM -Name $vm) -Datastore $destinationdatastore -DiskStorageFormat thin
}
Comments