Hi Every 1 ,
I have 10 VMs . Configuration is
Guest OS: WINDOWS XP
Partition : 15 GB ( Primary Partition), No extend partitions.
I want to extend pratimary partitions from 15GB to 30GB . Plz share the script .
Thanks & Regards,
BSR Krishna
You will probably be able to resize the virtual HDD using a script, however extending the guest OS partition needs to be done using a utility or from within the guest itself and since it is the system partition that needs to be done offline.
I'd recommend you use the GUI to increase the 10 VM's HDD's to the desired size. Then boot each of the VM's to a Vista/Windows7 CD/DVD into recovery mode, selecting the "open command line" option. There you can easily use diskpart to extend the partition using the following commands.
- list vol
- select vol ## (where ## is the number of the volume to extend)
- extend
- exit
André
HI ,
Thanks for response.
if i have 200 VMs how can do manual.. so i am looking for easy script to do the primariy partion extending .
Thnaks & Regards,
BSR Krishna
Hi,
You can do that using Set-HardDisk cmdlet. Since you want to extent the primary partition you need to pass additional winXP VM where the harddisk will be attached and extended (windows xp does not allow you to exend primary partition). You need ESX host and guest VM user and password as a prerequisite also. Here is the script:
$helperVM = Get-VM "winXPVM" Get-VM vm1 | Get-Harddisk | Set-HardDisk -CapacityKB 30*1024*1024 -HostUser "hostusername" -HostPassword "hostpassword" -GuestUser "guestUser" -GuestPassword "guestPassword" -HelperVM $helperVM
You can examine the bat script executed in the Windows XP guest located in <PowerCLI InstallDir>\Scripts\GuestDiskExpansion_winXPProGuest.bat (typically C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\GuestDiskExpansion_winXPProGuest.bat). It also use diskpart utility to extend the partition.
Please note that this cmdlet is experimental.
Regards,
Yasen