Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clear-Host
- Write-Host "This script starts by displaying the disks & associated partitions in a system.`nIt asks you to pick a disk and a partitions based on that list"
- #This is critical; it rescans the storage, otherwise Windows won't have realised the disk has been extended
- Update-HostStorageCache
- Get-Partition | Format-Table DiskNumber,DriveLetter,PartitionNumber
- $chooseDisk = Read-Host "Please pick a disk number"
- $choosePartition = Read-Host "Please pick a partition number"
- $supportedSize = Get-PartitionSupportedSize -DiskNumber $chooseDisk -PartitionNumber $choosePartition
- $sizeMax = [math]::Round($supportedSize.SizeMax / 1TB,1)
- Resize-Partition -DiskNumber 1 -PartitionNumber 2 -Size $supportedSize.SizeMax
- Write-Host "`nI've just extended the partition to" $sizeMax "TB"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement