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

}

Comments

Popular posts from this blog

Clearing DNS cache on vCenter Server Appliance

Repairing a virtual disk in Workstation (2019259)