How to extend the disk from existing disk in powershell

D Vijayakumar VLR 126 Reputation points
2022-02-10T05:25:48.25+00:00

Hi All,

I want to extend disk size 5GB or 10 GB in existing disk and i have windows and linux servers in vcenter i find VM with edit settings shows 5 Hard disk in VM (Hard disk 1, Hard disk 2, Hard disk 3, Hard disk 4 like that). i need to extend the hard disk 3 and 4 each 5 GB need to extend on multiple remote servers around 12 servers through powershell script guide me and teach me to learn new things it will helpfull for me.

Windows for business Windows Server User experience PowerShell
Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Clément BETACORNE 2,496 Reputation points
    2022-02-15T09:58:25.33+00:00

    Hello,

    Did you try that :

    # Variable specifying the drive you want to extend  
    $drive_letter = "C"  
      
    # Script to get the partition sizes and then resize the volume  
    $size = (Get-PartitionSupportedSize -DriveLetter $drive_letter)  
    Resize-Partition -DriveLetter $drive_letter -Size $size.SizeMax  
    

    You can find more information in this article :
    https://learn.microsoft.com/en-us/windows-server/storage/disk-management/extend-a-basic-volume

    Regards,

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.