Link to home
Start Free TrialLog in
Avatar of Ajay Pathak
Ajay PathakFlag for India

asked on

powershell script for expanding c drive in Vmware VM and extending the disk in same script

Can anyone help in extending the c drive:disk1 in vmware VM and extending the c drive in same script.
I am able to extend the disk via powercli with oneliner script but challenge is extending the c drive in windows without using diskpart diskmgmt.


Thanks
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Powershell 3.0 in Windows 8.0 and Windows 2012, has supported for re-size partition

Get-PartitionSupportedSize and Resize-Partition functions can be used.

What is your OS?
Avatar of Ajay Pathak

ASKER

Thanks Andy. I need to extend the c drive for multiple VMs on ESX.majority of these hosts are 2008 and I need a script for carrying on this task along with extending the disk
Personally, we would do it manually, and check all is okay, and make sure you have a full backup before you attempt this, as re-sizing often goes wrong in the OS. (not a snapshot!).

We would never attempt to write a powershell script to extend the disks, and OS partitions, that is asking for trouble, as so much can go wrong, and usually does manually, and then we only ever re-size a disk, by checking the existing resources, e.g. datastores, are not going to be low, e.g. less than 25-30% storage space.
I can only agree to that. I would not try to automate this action, at least not without including the backup - and that requires you to mix up outband and inband PowerShell code, making ti more complex than it is worth it.
ASKER CERTIFIED SOLUTION
Avatar of compdigit44
compdigit44

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial