Hello!
I have a 300+ vm`s on vsphere5.1 and i need to extend system drive on all of them. Have any ideas how to do it with powercli? Thanks.
You could try something like this.
It will increase the vmdk size by 20%. Note that the VM needs to be powered off for this.
Get-VM |
Where {$_.PowerState -eq "PoweredOff"} |
Get-HardDisk -Name "Hard disk 1" |
Set-HardDisk -CapacityGB ([int]($_.CapacityGB * 0.2)) -Confirm:$false -HelperVM $vm
You can find another example in Need a powercli script to increase Harddisk1 of VMs in a folder by 20GB, can someone give a script..
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
There are other factors that could influence the method to be used.
See 1. Re: Grow a VMs disk via PowerCLI
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
At this step I don't need resize partition inside guest. I have problem with grow up vmdk files for a list of vms and how to grow up only vmdk with the windows system directory
The Set-Harddisk cmdlet can be used to extend a VMDK.
Can your VMs have multiple harddisks ?
Any specific guest OS on these VMs ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, some of vms have more than one vmdk and no, nothing special inside guests, only windows
There is no foolproof method to link a guest OS partition to a VMDK file.
Is there only 1 guest partition on a VMDK ?
Is the system partition always on "Hard disk 1" ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes, system partition is always on hd1 and only one partition inside this vmdk.
You could try something like this.
It will increase the vmdk size by 20%. Note that the VM needs to be powered off for this.
Get-VM |
Where {$_.PowerState -eq "PoweredOff"} |
Get-HardDisk -Name "Hard disk 1" |
Set-HardDisk -CapacityGB ([int]($_.CapacityGB * 0.2)) -Confirm:$false -HelperVM $vm
You can find another example in Need a powercli script to increase Harddisk1 of VMs in a folder by 20GB, can someone give a script..
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you
can you explain why i need keeping my vms in powered off state while this script is running? if i can do this task from gui without power off vm why i cant do this way via powercli?
That is a requirement to use the HelperVM afaik.
An alternative is to use diskpart inside the guest OS.
See for example 5. Re: Grow a VMs disk via PowerCLI
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference